GoSub statement (LotusScript® Language)

Transfers control in a procedure to a labeled statement, with an optional return of control.

Syntax

GoSub label

Elements

label

The label of a statement to which you want to transfer control.

Usage

You can't use the GoSub statement at the module level; you can only use it in a procedure. The GoSub statement, its label, and the Return statement must all reside in the same procedure.

When LotusScript® encounters a GoSub statement, execution branches to the specified labeled statement and continues until either of two things happen:

  • LotusScript® encounters a Return statement, at which point execution continues from the statement immediately following the GoSub statement.
  • LotusScript® encounters a statement such as Exit or GoTo, which passes control to some other part of the script.

Example