do

A do statement repeatedly runs a statement until the test expression evaluates to 0. Because of the order of processing, the statement is run at least once.

The body of the loop is run before the controlling while clause is evaluated. Further processing of the do statement depends on the value of the while clause. If the while clause does not evaluate to 0, the statement runs again. When the while clause evaluates to 0, the statement ends. The controlling expression must be evaluate to a scalar type.

A break, return, or goto statement can cause the processing of a do statement to end, even when the while clause does not evaluate to 0.



Example Using the do Statement


break Statement
goto Statement
return Statement
while Statement