Loading

FOR

control
Configuration parameters

The FOR function implements a for loop. It takes three arguments from the stack: the initial and the final values of the loop index and a macro 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. Since Warp 10 2.4.0, you can override this behaviour with a boolean.

FOR is available since version 1.0.0.

See also

Signature

Examples

// Macro that squares the value on the top of the stack <% 2 ** %> 'SQUARE' STORE // FOR from i=1 to i=10 generate i^2 1 10 $SQUARE FOR
// repeat 5 times the same word to build a string '' 1 5 <% 'Warp10' + %> F FOR //F is a faster way to write false