Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

For

Usage

For[start, test, incr, body] executes start, then repeatedly evaluates body and incr until test fails to give True.


Notes

For evaluates its arguments in a non-standard way.
For[start, test, incr] does the loop with a null body.
• The sequence of evaluation is test, body, incr. The For exits as soon as test fails.
• If Break[ ] is generated in the evaluation of body, the For loop exits.
Continue[ ] exits the evaluation of body, and continues the loop by evaluating incr.
• Unless Return[expr] or Throw[expr] is generated, the final value returned by For is Null.
• Example: For[tot=0; i=0, i < 3, i++, tot += f[i]]. Note that the roles of semicolon and comma are reversed relative to the C programming language.
• See Section 2.6.9.
• See also: Do, While, Throw, NestWhile.
• New in Version 1.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: