Index
Flow Control

do

do(<-limit <-start)

Description

The statements following the do, up to the loop statement, are executed repeatedly. An index counter is initialized to (start). The index will be incremented, or decremented, by one at the bottom of the loop. When the index counter is one away from the limit, execution will proceed at the first statement following Loop. Loops can be nested, but no more than 3 deep.

NOTE: If (limit) is less than (start), the the loop decrements rather than increments. The range of a do loop is always [start->limit] (inclusive of start and exclusive of limit).

Examples

# single loop
do(3 0)
   trace(I)
loop
#  Prints:
#  0
#  1
#  2
 
# single decrementing loop
do(0 3)
   trace(I)
loop
#  Prints:
#  3
#  2
#  1
 
Nested loops
 
do(2 0)
    trace(I)
    Do (4 2)
        Trace2 (J I)
        Do (6 4)
            Trace3 (K J I )
        loop
    loop
loop

Index