• For[start, test, incr, body] executes start, then repeatedly evaluates body and incr until test fails to give True.
• The sequence of evaluation is test, body, incr. The For exits as soon as test fails.
• Example: For[tot = 0; i = 0, i < 3, i++, tot =tot+ f[i]]. Note that the roles of semicolon and comma are reversed relative to the C programming language.
• See also: Do, Table, While.
Here are the InstantCalculators for the For function. Enter the parameters for your calculation and click Calculate to see the result.
Entering Commands Directly
You can paste a template for this command via the Text Input button on the For Function Controller.
Here is a common form of a For loop. The semicolon separates the multiple commands of the start and the body. The loop terminates as soon as the test < 10 fails.
Clear the variable definitions.