while

C++ Reference

while
Syntax:
  while( condition ) {
  statement-list;
  }

The while keyword is used as a looping construct that will evaluate the statement-list as long as condition is true. Note that if the condition starts off as false, the statement-list will never be executed. (You can use a do loop to guarantee that the statement-list will be executed at least once.) For example:

   bool done = false;
   while( !done ) {
     ProcessData();
     if( StopLooping() ) {
       done = true;
     }
   }            
Related topics: