The do...while Statement
while statement evaluates its condition before entering the loop body on every iteration. If evaluation of the condition at the end of the loop is desired, the
do statement is your choice:
do embedded statementwhile (condition);
(Don’t forget the semicolon at the end of the last line.) An implication of this loop structure is that the body of the loop runs at least once. Control simply falls into the loop at the start, and when the condition at the end evaluates positively, control is transferred to the beginning of the loop body again.
As with the
while statement, the
continue statements can be used in a
do statement’s embedded statement, too.
Note: Code Maintenance Caveat
Because I once spent a couple ...