Mathematica 9 is now available

DoFor

While

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

FilledSmallSquareWhile[test] does the loop with a null body.

FilledSmallSquare If Break[ ] is generated in the evaluation of body, the While loop exits.

FilledSmallSquareContinue[ ] exits the evaluation of body, and continues the loop.

FilledSmallSquare Unless Return[ ] or Throw[ ] are generated, the final value returned by While is Null.

FilledSmallSquare Example: i=0; While[i < 0, tot += f[i]; i++]. Note that the roles of ; and , are reversed relative to the C programming language.

FilledSmallSquare See The Mathematica Book: Section 2.5.9.

FilledSmallSquare See also: Do, For, NestWhile, Nest, Fold, Select, Throw.

Further Examples

DoFor



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.