[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
while                    while Statement

 while ( expression_list )
     statement;

    The while  statement executes  the statements  in the  body as  long as
    expression_list 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 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 return for
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson