|
Java Reference Home | Smart Soft Home |
|
|
do
CategoryLoopsDescriptionUsed to define a loop that repeats until a boolean expression becomes true. Differs from the while loop in that the boolean expression isn't evaluated until the bottom of the structure. This means that the code inside thedo will always execute at least once, regardless of the boolean expression.
Exampledo {
System.out.println("Do this as long as x is less than 10");
System.out.println("Do this as long as x is less than 10");
System.out.println("Do this as long as x is less than 10");
} while (x<10);
|
|