LOTUSSCRIPT LANGUAGE


Exit statement
Example

Terminates execution of the current block statement.

Syntax

Exit blockType

Elements

blockType


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 typeExecution continues
Exit DoAt the first statement following the end of the Do block statement.
Exit ForAt the first statement following the end of the For block statement.
Exit ForAllAt the first statement following the end of the ForAll block statement.
Exit FunctionIn the calling script, as it would from a normal return from the procedure.
Exit SubIn the calling script, as it would from a normal return from the procedure.
Exit PropertyIn 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 ("").

Language cross-reference

@Return function in formula language

Example
See Also