FOR variable-name = expression TO expression [ STEP expression ]
FOR EACH variable-name IN variable-name

   Synopsis:
      There are two forms of the FOR..NEXT loop.

      The first is the 'original' form of a FOR..NEXT loop in BASIC. It uses a
         numeric iterator with an optional numeric increment. If no increment
         is specified, an increment of 1 is used.
      It is important to remember that, when the loop terminates, the iterator
         is still incremented. Thus, after

         FOR a = 1 to 10

      ...the variable 'a' will be set to 11.
      
      The iterator can be updated during the loop. Thus, during the same loop,
         it would be possible (though not recommended) to change the value of
         the iterator, so as to repeat or skip a step. If the iterator's new
         value exceeds the value of the TO expression, the loop terminates in
         all cases.

      The second form begins FOR EACH. It's a useful way of 'walking' an array:
         doing something with every value in the array, one after the other. It
         is especially useful with multi-dimensional arrays, because you can
         replace this:
         
         DIM stuff (3, 3, 3)
         FOR a = 1 to 3
            FOR b = 1 to 3
               FOR c = 1 to 3
                  PRINT stuff (a, b, c)
                NEXT c
            NEXT b
         NEXT a

      ...with this:

         DIM stuff (3, 3, 3)
         FOR EACH a IN stuff
            PRINT stuff (a, b, c)
         NEXT a

      A one-dimensional array is walked from beginning to end. A multi-
         dimensional array is walked from the bottom up; in other words, a 3x3
         array is walked in the sequence (1, 1), (1, 2), (1, 3), (2, 1)...
      In this form of a FOR..NEXT loop, changing the iterator has no effect.
         The array is still walked from beginning to end (or bottom to top),
         and the values in the array are not modified.
      Both the iterator and the array must be numeric, or both must contain
         strings. This is not a valid Axbasic programme:

         DIM string$ (10)
         FOR EACH number in string$
            PRINT number
         NEXT number
         END

      FOR..EACh cannot iterate over an empty array. If you try, you will get an
         error.  

   Notes:
      In a FOR..TO..NEXT loop, the expressions must be integers.

   Examples:
      ! Print the numbers 1 to 10 in sequence
      FOR a = 1 TO 10
         PRINT a
      NEXT a

      ! Print the even numbers from 2 to 10 in sequence
      FOR a = 2 TO 10 STEP 2
         PRINT a
      NEXT a

      ! Print the numbers 1 to 10 in reverse sequence
      FOR a = 10 to 1 STEP -1
         PRINT a
      NEXT a

      ! Walk a one-dimensional array, displaying its values
      DIM list (3)

      DATA 10, 20, 30
      FOR a = 1 TO 3
         READ list (a)
      NEXT a

      FOR EACH number IN list
         PRINT number
      NEXT number
      
      ! Walk a two-dimensional array, displaying its values
      DATA "top left", "top middle", "top right"
      DATA "centre left", "centre middle", "centre right"
      DATA "bottom left", "bottom middle", "bottom right"

      DIM grid$ (3, 3)
      FOR a = 1 TO 3
         FOR b = 1 to 3
            READ grid$ (a, b)
         NEXT b
      NEXT a

      FOR EACH a$ IN grid$
         PRINT a$
      NEXT a$
