Skip to main content
Untitled Document





          FOR expr [ USING var ] LOOP
             [ EXIT LOOP ]
          END LOOP

statement_block is executed expr times. If USING var is defined, the index is kept in var, beginning with zero and incrementing towards expr. If var is not large enough to hold expr, a warning is generated. If [EXIT LOOP] is used, the loop is immediately exited.


expr is evaluated once on entry to the FOR statement.

On normal exit, var is equal to expr. After, `EXIT LOOP,' var holds whatever value it had at the beginning of the loop.

If expr is a cexpr and is one larger than var can hold, the loop will be exited when var rolls over to zero. In this case, on exit var will be zero.


          VAR BYTE n
          FOR 256 USING n LOOP
          END LOOP

On exit, n will be zero.

          xx = 0
          FOR 10 LOOP
             xx = xx + 1
             IF (xx == 5) THEN
                EXIT LOOP
             END IF
          END LOOP