Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Procedural Programming > Flow Control > Break >

Break

Break
exits the nearest enclosing Do, For, or While.
  • Break takes effect as soon as it is evaluated, even if it appears inside other functions.
  • After a Break the value Null is returned from the enclosing control structure.
Break out of the Do when is larger than 2:
Break out of the Do when is larger than 2:
Break out of a Do loop:
Break out of a For loop:
Break out of a While loop:
Test the condition of a loop during or at the end of the loop:
Use Throw and Catch instead of Break:
Continue skips the rest of a loop, but resumes with the next iteration:
New in 1 | Last modified in 3
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF