How does a 'while' control structure differ from 'do while ' structure?

The while loop first check the condition given in the while statement. If this condition is satisfied, then the statements in the while loop is executed.

In 'do while ' loop first the statements in the loop are executed then the condition is checked. If condition is true then again the statements are executed. In do while loop at least once the statements in the loop are guaranteed to be executed.

Post a Comment

0 Comments