qck.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
FOR...NEXT Statement
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Repeats a block of statements a specified number of times.
 
    FOR counter = start TO end [STEP increment]
         [statementblock]
         [EXIT FOR]
         [statementblock]
    NEXT [counter [,counter]...]
 
    ■ counter         Numeric variable used as the loop counter; cannot be
                      an array or record element
 
    ■ start           Initial value of counter
 
    ■ end             Final value of counter
 
    ■ STEP increment  Amount counter is changed each time through the loop;
                      if STEP is omitted, increment defaults to one
 
    ■ statementblock  One or more valid statements on one or more lines
 
    ■ EXIT FOR        Alternative exit from FOR...NEXT loop; transfers
                      control to the statement following the NEXT keyword
 
 See Also
    DO...LOOP Statement              Loops and Decision Structures
    WHILE...WEND Statement