With each iteration of the basic
LOOP statement, its statements run and control returns to the top of the loop. The
LOOP statement ends when a statement inside the loop transfers control outside the loop or raises an exception.
See "statement ::=".
To prevent an infinite loop, at least one statement must transfer control outside the loop. The statements that can transfer control outside the loop are:
"CONTINUE Statement" (when it transfers control to the next iteration of an enclosing labeled loop)
Labels improve readability, especially when
LOOP statements are nested, but only if you ensure that the label ine the
LOOP statement matches a label at the beginning of the same
LOOP statement (the compiler does not check).