What I'm wondering about right now is how the for <assignment> to <expr> [step <
>] ... next works in "standard" basic?
If I understand the question...,
that is simple to illustrate:
You would assume the default STEP value to be "1", as in:
FOR indx=1 TO 100 STEP 1
....
NEXT indx
however, you can't assume that the incrementation is always going to be by a factor of "1".
As in "C":
for(indx=0; indx <= 100; indx++)
{
....
}
what about:
for(indx=0; indx <= 100; indx += 2)
?
In the above, you have:
for(indx=0; indx <= 100; indx += 2)
-FOR- / -TO- / -STEP-
So, the STEP value is any value (or evaluation) other that "1".
If the STEP value is "1", then the step value need not be stated, as the default is "1".
FOR indx = 1 TO 100
....
NEXT indx
The STEP value would not be a constant.
It has to be the a value given, a variable, the result of an expression, or the default if none is stated.
FOR x = 1 TO 100 (default "1")
FOR x = 1 TO 100 STEP 3
FOR x = 1 TO 100 STEP MyVar
FOR x = 1 TO 100 STEP [expression]
NOTE:
once the entire FOR/NEXT expression is evaluated, prior to the first pass, the STEP value cannot change.
"x" is the only value that is allowed to change during the loop process.
As in:
FOR x = val1 TO val2 STEP val3