EXIT v11
The innermost loop is terminated and the statement following END LOOP
is executed next.
If WHEN
is present, loop exit occurs only if the specified condition is TRUE
, otherwise control passes to the statement after EXIT
.
EXIT
can be used to cause early exit from all types of loops; it is not limited to use with unconditional loops.
The following is a simple example of a loop that iterates ten times and then uses the EXIT
statement to terminate.
The following is the output from this program.