Next: , Up: Loops   [Contents][Index]


10.10.1 while

The while statement has this form:

while (exp) stmt

where exp is an expression that should evaluate to a boolean (i.e. to an integer) and stmt is an statement that will be executed until exp holds false.

It is possible to leave the loop from within stmt using the break statement. Example:

while (1)
{
  […]
  if (exit_loop)
    break;
}