] executes start, then repeatedly evaluates body and incr until test fails to give True.
For evaluates its arguments in a non-standard way.
] does the loop with a null body.
The sequence of evaluation is test, body, incr. The For exits as soon as test fails.
] is generated in the evaluation of body, the For loop exits.
] exits the evaluation of body, and continues the loop by evaluating incr.
] or Throw[
] is generated, the final value returned by For is Null.
f[i]]. Note that the roles of semicolon and comma are reversed relative to the C programming language.
See the Mathematica book: Section 2.5.9.
See also: Do, While, Throw.
Here is a common form of a For loop. i++ increments the value of i each time through the loop.
Here is a more complicated For loop. The loop terminates as soon as the test i^2
1 + x
3 + x
6 + x
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER
FOR THE LATEST INFORMATION.