With
the help of do-while statement we can execute the body of the loop before the
test is performed.
On reaching the do statement, the program proceeds to evaluate the body of the loop
first. At the end of the loop, the test-condition
in the while statement is evaluated.
If the condition is true the program continues to evaluate the body of the loop once again. This process continues
as long as the condition is true.
When the condition becomes false, the loop will be terminated and the control
goes to the statement that appears immediately after the while statement.
No comments:
Post a Comment