Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>break</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  BREAK

  Often while using a looping statement (while, do...while, for), it
  is necessary to break out of (exit) the loop. The break statement
  serves this purpose. When the break statement is encountered, execu-
  tion of the innermost while, do...while, or for loop is terminated,
  and execution continues immediately after the last statement of the
  terminated loop.  It is an error for a break statement to appear
  outside of a loop. The format of the break statement is:

       break;

  For example, assuming you had the following code:

       int num = 0;
       while (1)
        {
         num = num + 1;
         if (num > 100)
           break;
        }
       prints("Done");

  Ordinarily, since there will always be a non-zero (TRUE) value in
  the conditional part of this while statement, it would execute for-
  ever. However, when the 'num' variable is > 100, the break statement
  is executed to exit from the loop, at which point the next statement
  would be executed (the function call to prints).

See Also: continue do for while

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson