do run clause, check a condition, repeat until condition is false for iterate over a value, run clause and repeat until value matches a condition if run clause if condition is true switch compare a value to various possibilities and run the clause that matches while check a condition, return if condition is false, or run proccess and repeat
Executes argument 0, then evaluates argument 1. If argument 1 returns a non-zero number, argument 0 is executed again, and the process repeats until argument 1 returns false (0). Argument 0 is therefore guaranteed to be called at least once.
0. any (required): code to evaluate
1. boolean number (required): if true, call argument 0 again
The result of argument 0 the last time it is evaluated, or nil if it is never evaluated
value: 9;
string: "";
do[{
string: string $ tostr[value];
value: value - 1;
}, value > 0];
string; => "987654321"
This function is useful for looping through values where the initinal and number of iterations are known, though it isn't limited to this. First, argument 0 is evaluated, usually used to create and set an intial value to a symbol, which has a scope only of the for function call. Then, argument 1 is evaluated. If it returns zero, the for function is ended and the result of the last evaluation of argument 3 is returned. (If argument 3 had never been evaluated, nil is returned.) If argument 1 returns non-zero, then argument 3 is evaluated. Finally, argument 2 is then evaluated, usually to change the value of the symbol created in argument 0.
0. any (required): evaluated once once the for function is called
1. boolean number (required): if non-zero, the for loop continues by evaluating argument 3; if zero, the last result of argument 3 is returned, if argument 3 had not been evaluated, nil is returned
2. any (required): always evaluated after argument 3 is evaluated, usually to change the value of the symbol craeted in argument 0; argument 1 is evaluated after this argument is
3. any (required): this argument is usually used to perform the purpose of the call to the for function; it is evaluated over and over again as long as argument 1 retusns non-zero
The result of the last evaluation of argument 3 or nil if argument 3 is never evaluated
for[x: 0, x < 10, x: x + 1, {
string: string $ tostr[x];
}]; => "0123456789"