Conditional Phrases (WHILE and UNTIL)

A conditional phrase can modify the iteration of a repetitive loop. It can cause the termination of a loop. It can follow any of the forms of repetitor (none, FOREVER, simple, or controlled). If you specify WHILE or UNTIL, exprw or expru, respectively, is evaluated after each loop using the latest values of all variables, and the loop is ended if exprw evaluates to 0 or expru evaluates to 1.

For a WHILE loop, the condition is evaluated at the top of the group of instructions. For an UNTIL loop, the condition is evaluated at the bottom--before the control variable has been stepped.

Example:

Loop I=1 to 10 by 2 until i>6
   say i
end
/* Displays: "1" "3" "5" "7" */

Note: Using the LEAVE or ITERATE instructions can also modify the execution of repetitive loops.