do

Loops through the statements enclosed within the { code block } until the following while test expression is false:

 

do {
statements ;
} while (test expression) ;

 

*note the ending semi-colon ; after the while test expression!

 

Compile & Run:

myVar is now: 0
myVar is now: 1
myVar is now: 2
myVar is now: 3
myVar is now: 4

Leave a Reply