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; }
It is also possible to jump to the next iteration of the loop from
within stmt using the continue
statement. Example:
while (1) { [...] if (continue_loop) continue; }