Summary: The while Statement

I l @ ve RuBoard

Summary: The while Statement

Keyword

The keyword for the while statement is while .

General Comments

The while statement creates a loop that repeats until the test expression becomes false, or zero. The while statement is an entry-condition loop; the decision to go through one more pass of the loop is made before the loop has been traversed. Therefore, it is possible that the loop is never traversed. The statement part of the form can be a simple statement or a compound statement.

Form

 while (  expression  )  statement  

The statement portion is repeated until the expression becomes false or zero.

Examples

 while (n++ < 100)       printf(" %d %d\n",n, 2*n+1); while (fargo < 1000) {       fargo = fargo + step;       step = 2 * step; } 
I l @ ve RuBoard


C++ Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 314
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net