Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>while while statement</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
while                    while Statement

 while (expression)
     statement;

    The while statement executes the statements in the body as long as
    expression is TRUE (not 0).  The expression is tested at the top of
    the loop before the body is executed.  If the expression tests false
    initially, the body of the loop is never executed.  When the
    expression tests false control is passed to the next statement
    following the loop.  The while loop may also be terminated by a
    break, goto or return statement.

       Note:    The parentheses around expression are required.

                The while loop may not be executed at all whereas the
                do-while loop is always executed at least once.

  -------------------------------- Example ---------------------------------

           while (i >= 0) {
               function(i);
               i--;
           }

    The following while loop is terminated by the `break' inside the
    loop.

           while (1) {
               value = search(value);
               if (value == 0)
                   break;                    /* Terminates the while loop */
           }

See Also: do break return continue goto return for

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