Do While Loop


On page 60 we are constructing a Do While loop to print Aaron is Cool 12 times, similar to the While and For loop examples. The code for the Do While initializes variable i to 0 and increments before the While condition is tested - While (i<12); . However the graphic on that page shows the logic as testing is i < 13. Should that not be 12 instead of 13?

Logically if the test is after the block being executed, the loop will run until i = 11 at which point the “11. Aaron is Cool” will print and i is incremented to 12 and will fail the while test I < 12 and then drop out of the loop.

Am I getting this right or am I messed up? Thanks.


I’m thinking that was a typo in the illustration.