|
Hi Eranga,
Basically what tim is trying to tell you is that the condition {i<21} in a do-while loop comes up at the end. What happens in this case is for the first time there is no condition to check and the data will get printed in any case. Only after the printing of data will the condition be checked. For instance if you had initiated i to 24 to start off, the piece of code without the if condition will print 24, and then check the condition. Hence only 24 will get printed. Infact the basic purpose of a do while loop is when you are sure that the piece of code has to get executed at least once.
|