C++ Syntax: while


The while statement has the form:-
while ( expression ) statement
While the expression evaluates to true (not zero) the following statement, which is normally a compound statement is executed. For example:-
Int_t limit = 10;
Int_t factorial = 1;

while ( limit ) {
  factorial *= limit;

Usage Notes

The break statement is frequently used in conjunction with the while statement.
Go Back to the The C++ Crib Top Page

If you have any comments about this page please send them to Nick West