Java Reference
In-Depth Information
loopVar = 0;
External initialization
do
Start of loop
{
// Processing statements
loopVar++;
Loop variable update
}
while(loopVar != 10);
Loop continuation test
Figure 10-4 Elements of the do-while Loop Construct
In many cases the processing performed by the do-while loop is identi-
cal to the one performed by the while loop.
Programmers note:
The test expression in a do-while loop terminates in a semicolon sym-
bol. Since a while statement does not contain a semicolon, it is a com-
mon mistake to omit it in the do-while loop.
 
Search WWH ::




Custom Search