The do-while loop is analogous to the while loop in that the loop body is repeatedly executed over and over again as long as the Boolean expression is true. However, there is one important difference—the loop body, located between the keywords do and while (see Syntax Box 9.2), is executed before the Boolean expression is evaluated. Consequently, the loop body of the do-while loop is always executed at least once, even if the Boolean expression is false initially.
Syntax Box 9.2 The do-while Statement
do_while_statement:= do <Loop_body> while (<Loop_condition>);
<Loop_body>::= <Statement>; ::= <Compound_statement> <Loop_condition>::= <Boolean expression>