EXIT
The EXIT statement can terminate FOR, FOREACH, LOOP, or WHILE statements.
Syntax
Element | Description | Restrictions | Syntax |
---|---|---|---|
condition | Loop terminates when this evaluates to TRUE. | If condition evaluates to FALSE, the loop continues. | Condition |
label | Label of a loop from which to exit | Must be the label of a loop statement that includes the EXIT statement | Identifier |
Usage
The EXIT statement transfers control of execution from an iterative statement, causing the innermost loop of the enclosing statement type (FOR, FOREACH, LOOP, or WHILE) to terminate. If no loop label or WHEN condition is specified, execution resumes at the first statement that follows the current FOR, FOREACH, LOOP, or WHILE statement.