Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The do statement executes a Statement and an Expression repeatedly until the value of the Expression is false.
DoStatement:
do Statement while ( Expression ) ;
The Expression must have type boolean, or a compile-time error occurs.
A do statement is executed by first executing the Statement. Then there is a choice:
- If execution of the Statement completes normally, then the Expression is evaluated. If evaluation of the Expression completes abruptly for some reason, the
dostatement completes abruptly for the same reason. Otherwise, there is a choice based on the resulting value:- If the value is
true, then the entiredostatement is executed again. - If the value is
false, no further action is taken and thedostatement completes normally.
- If the value is
- If execution of the Statement completes abruptly, see ยง14.11.1 below.
Executing a do statement always executes the contained Statement at least once.