OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


ITERATE




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

ITERATE is used to alter the flow within a repetitive DO loop (that is, 
any DO construct other than that with a simple DO loop). 
Processing of the group of instructions stops, and control is passed to 
the DO instruction just as though the END clause had been encountered. The 
control variable (if any) is incremented and tested, as normal, and the 
group of instructions is processed again, unless the loop is terminated by 
the DO instruction. 
If name is not specified, ITERATE steps the innermost active repetitive 
loop. If name is specified, it must be the name of the control variable of 
a currently active loop which may be the innermost loop; this is the loop 
that is stepped. Any active loops inside the one selected for iteration 
are terminated (as though by a LEAVE instruction). 
Example: 

do i=1 to 4
  if i=2 then iterate
  say i
  end
/* Would display the numbers:   1, 3, 4  */

Notes: 
   1. If specified, name must match the name on the DO instruction in all 
      respects except 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 during 
      execution of a loop, a subroutine is called or an INTERPRET 
      instruction is processed, the loop becomes inactive until the 
      subroutine has returned or the INTERPRET instruction has completed. 
      ITERATE cannot be used to step an inactive loop. 
   3. If more than one active loop uses the same control variable, the 
      innermost loop is the one selected by ITERATE. 
   

Inf-HTML End Run - Successful