ITERATE

>>-ITERATE--+------+--;----------------------------------------><
            +-name-+

ITERATE alters the flow within a repetitive loop (that is, any DO construct other than that with a simple DO or a LOOP instruction).

Execution of the group of instructions stops, and control is passed to the DO or LOOP instruction just as though the END clause had been encountered. The control variable, if any, is incremented and tested, as usual, and the group of instructions is processed again, unless the DO or LOOP instruction ends the loop.

The name is a symbol, taken as a constant. If name is not specified, ITERATE continues with the current repetitive loop. If name is specified, it must be the name of the control variable or the LABEL name of a currently active loop, which can be the innermost, and this is the loop that is stepped. Any active loops inside the one selected for iteration are ended (as though by a LEAVE instruction).

Example:

loop label MyLabelName i=1 to 4 /* label set to 'MYLABELNAME' */
  if i=2 then iterate
  say i
end myLabelName
/* Displays the numbers:
  1
  3
  4
*/

Notes:

  1. If specified, name must match the symbol naming the control variable or LABEL name in the DO or LOOP clause in all respects except the case. No substitution for compound variables is carried out when the comparison is made.

  2. A loop is active if it is currently being processed. If a subroutine is called, or an INTERPRET instruction is processed, during the execution of a loop, the loop becomes inactive until the subroutine has returned or the INTERPRET instruction has completed. ITERATE cannot be used to continue with an inactive loop.

  3. If more than one active loop uses the same name, ITERATE selects the innermost loop.