August 1999
Intermediate to advanced
1488 pages
72h 53m
English
do{
statement;
}while(expression);
The do…while loop always executes the loop once before evaluating the expression for the first time. Once the loop has executed for the first time, the expression, in parenthesis, is evaluated. If true, the loop is executed again. When the expression evaluates to false, the next line of code following the while structure is executed. A statement must be included in the loop that modifies a variable in the expression to prevent an infinite loop. Also, notice that a semicolon (;) must be placed after the right parenthesis.
Listing 6.116 uses the do…while loop to control access through a gate. ...
Read now
Unlock full access