Return (statement)

Syntax

Return

Description

Transfers execution control to the statement following the most recent GoSub.

Comments

A runtime error results if a Return statement is encountered without a corresponding GoSub statement.

Example

This example calls a subroutine and then returns execution to the Main routine by the Return statement.

Sub Main()
  GoSub SubTrue
  MsgBox "The Main routine continues here."
  Exit Sub

SubTrue:
  MsgBox "This message is generated in the subroutine."
  Return
  Exit Sub
End Sub

See Also

GoSub (statement).

More information

R