FOR executes a series of instructions in a loop a given number of times.
FOR N = A TO B STEP C
Where N is a variable, A is a numeric start value, B is a numeric end value and C is an increment/decrement value.
A, B and C can be numbers, variables or expressions.
10 FOR A = 1 TO 100 STEP 10 100 NEXT A
causes the value of A to equal 1,11,21 etc., for each execution of the loop.
To obtain a decrementing count negative values of STEP are used.
1000 FOR Z1=91 TO 10 STEP -.1 1050 NEXT Z1
When followed by a NEXT statement, FOR will execute the intervening parameters for the number of times indicated by the values A and B divided by N to the formula:
Failure to do this will result in a control stack error.