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

While

Usage

While[test, body] evaluates test, then body, repetitively, until test first fails to give True.


Notes

While[test] does the loop with a null body.
• If Break[ ] is generated in the evaluation of body, the While loop exits.
Continue[ ] exits the evaluation of body, and continues the loop.
• Unless Return[ ] or Throw[ ] are generated, the final value returned by While is Null.
• Example: i=0; While[i < 0, tot += f[i]; i++]. Note that the roles of ; and , are reversed relative to the C programming language.
• See Section 2.6.9.
• See also: Do, For, NestWhile, Nest, Fold, Select, Throw.
• 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: