Form:
while(true/false){...}
The while loop is executed each time round so if the value to be tested is set here it will be reset every time round.
while( (x = getX()) != 0 )
{
...
}
If getX() returns an int then this loop will never finish.
do{...} while(true/false)
Examples of valid do … while loops
do { break ; } while (true) ;
Leave a comment