Exit |
LRM §8.11. |
A sequential statement which is used to finish or exit the execution of an enclosing loop statement.
[ label: ] exit [ loop_label ] [ when condition ];
The exit statement terminates entirely the execution of the loop in which it is located. If a condition is placed on the exit statement, then the execution of the exit statement depends on the condition placed at the end of the statement. When the condition is true (or if there is no condition at all) the exit statement is executed and the control is passed to the first statement after the end loop.
The loop label in the exit statement is optional and can be used only in case of labeled loops. If no label is present then it is assumed that the exit statement relates to the innermost loop containing it. If an exit from a loop on a higher level of hierarchy is needed then the loop has to be assigned a label, which will be used explicitly in the exit statement.
L1: loop L2: for I in B'range loop if B(I) = 'U' then exit L1; end if; exit when I = M; end loop L2; ... end loop L1;