Exit statement (LotusScript® Language)

Terminates execution of the current block statement.

Syntax

Exit blockType

Elements

blockType

A keyword designating the type of the block statement for which execution is to be terminated. It must be one of the following keywords:

Do For ForAll Function Sub Property

Usage

When LotusScript® encounters this statement, it returns control to the scope containing the block statement for which execution is to be terminated.

An Exit statement of a particular type is legal only within an enclosing block statement. LotusScript® returns control from the innermost block statement or procedure of that type.

However, the innermost block statement containing the Exit statement need not be of that type. For example, a function definition can include a For...Next block statement, and an Exit Function statement can appear within this statement. If LotusScript® encounters the Exit Function statement during execution, control is returned immediately from the function, in which case the For...Next block statement is not executed to completion.

The following table shows the rules for transfer of control after the Exit statement.

Exit block type

Execution continues

Exit Do

At the first statement following the end of the Do block statement.

Exit For

At the first statement following the end of the For block statement.

Exit ForAll

At the first statement following the end of the ForAll block statement.

Exit Function

In the calling script, as it would from a normal return from the procedure.

Exit Sub

In the calling script, as it would from a normal return from the procedure.

Exit Property

In the calling script, as it would from a normal return from the procedure.

If you exit a function or a Property Get without assigning a value to the function or property variable, that function or property returns the initialized value of the variable. Depending on the data type of the function or property's return value, this value can be either 0, EMPTY, or the empty string ("").

Example