Since v1.0.0
Available on all platforms
See also

Configuration parameters

The FORSTEP function implements for loop with an index step. It takes four arguments from the stack : the initial and the final values of the loop index, a macro step to evaluate after each iteration and an other one to be executed at each iteration.

For each iteration the loop index is put on top of the stack, and the exec macro is then called.



// Macro that squares the value on the top of the stack <% 2 ** %> 'SQUARE' STORE // Macro step, increasing index by two <% 2 + %> 'STEP' STORE // FOR from i=0 to i=20 with a step of 2generate i^2 0 20 $STEP $SQUARE FORSTEP