Next: break and continue Up: Looping and Iteration Previous: The while statement

The do-while statement

C's do-while statement has the form:

It is similar to PASCAL's repeat ... until except do while expression is true.

For example:

..outputs:-

NOTE: The postfix x- operator which uses the current value of x while printing and then decrements x.


Dave.Marshall@cm.cf.ac.uk
Wed Sep 14 10:06:31 BST 1994