while (comparison) { instructions... }

do { instructions... } while (comparison) ;

Repeats all instructions between the winged brackets as long as the comparison between the round brackets is true resp. evaluates to non-zero. This repetition of instructions is called a loop. The while statement evaluates the comparison at the begin, the do..while statement at the end of each repetition.



int x = 0;
while(x < 100) // repeat while x is lower than 100
{ x += 1; }

See also:

if, goto, break, continue, comparisons

► latest version online