Synopsis:
   for ([<pre>],[<condition>],[<post>]) { <action> }
   for <var> from <min> to <max> [step <step>] { <action> }
   for <var> in (<word list>) { <action> }

Description:
   Form 1:

   FOR is a general purpose loop.  It is modeled on the C for statement,
   and works in a very similar manner.  Aside from the action, there are
   three parts to a FOR loop:

   * The "pre" part is executed before the loop begins iterating.  This is
     often used for initializing counters and other variables that will be
     used in the loop.

   * Before each loop iteration, the "condition" is checked.  Most often,
     this is used to see if the counter has exceeded a certain limit.  The
     condition may contain any expression legal in the IF command.
     Because of this, the loop does not necessarily have to iterate at all.

   * The "post" part is executed after the condition, if the condition
     returns true.  This is generally used to increment a counter that
     gets checked by the condition statement.

   Multiple commands may be used in each part; they must be separated by
   semicolons (giving it something of a reverse-C syntax).  Note that
   there does not necessarily need to be any commands in any part.  The
   action is optional as well.

   Form 2:

   This second form of the command provides a FOR .. NEXT type loop in
   which you are allowed to step through a range of numbers and perform
   an action on each one.

   * The "var" argument is the name of the local variable that you wish to
     store the value for the current iteration.

   * The "min" and "max" arguments should be integers that specify the
     range to be operated upon. Negative numbers are legal.

   * The optional "step" argument can be used to specify a different value
     to step by when incrementing the "var" argument. Positive numbers only.
     The default is "1".

   This form of the FOR command is much cheaper than a traditional FOR
   loop that does the same thing, or a FE loop over the return value of
   the $jot() function that does the same thing.

   The CONTINUE and BREAK commands are honored in the action body.
   The CONTINUE command will behave as a "next" operation, and the BREAK
   command will abort the loop entirely.

   Form 3:

   This third and final form is a FOR .. IN LIST type loop that allows
   actions to be performed one at a time on each item in the specified
   word list.

   Like the second form, this acts as a cheap version of the FE command
   for those cases where you need to iterate over each word one at a time.

   The CONTINUE and BREAK commands are also honored in the same way
   as in the second form above.

Examples:
   Form 1:

   To display a warning message 3 times:
      for ( @ xx = 3, xx > 0, @ xx-- ) {
         echo WARNING!  This ship will self destruct in $xx seconds!
      }

   A infinite loop that behaves like the Unix 'yes' command:
      for ( ,, ) {
         echo yes
      }

   Form 2:

   Display the numbers 1 through 5 each on a separate line:
      for ii from 1 to 5 {
         echo $ii
      }

   Display the numbers 1, 3, and 5 each on a separate line:
      for ii from 1 to 5 step 2 {
         echo $ii
      }

   Form 3:

   Display the words "one", "two", and "three" each on a separate line:
      for xx in (one two three) {
         echo $xx
      }

See Also:
   fe(5); fec(5); foreach(5); until(5); while(5)

