Search                        Top                                  Index
HELP TO                                                 A. Sloman, April 1985

This is used in one form of the FOR statement, viz:

    for <variable> from <expression1> by <expression2> to <expression3> do

binds the variable to the result of evaluating the first expression and then
performs <actions>; the second expression is then added to the variable. If it
is less than or equal to the third expression the actions are performed again.
The addition, testing and execution of actions is repeated until the variable
exceeds the value of the third expression.

If expression2 is negative (before the loop is entered) then the termination
test uses "<" instead of ">".

In this form the 'by <expression2>' can be omitted; it will be assumed to be
'by 1'. The same applies to 'from <expression1>'.

    *FOR   - forms and uses of FOR loops in iteration over lists and integers
    *LOOPS - for other types of iteration