Norway


Here you will get to know about between while and do while .

Both while and do while loops are used to execute set of statements multiple times. But there are some differences between them in terms of syntax and working that I have discussed below.

Difference between while and do while Loop

while loop syntax

do while loop syntax

while loop do while loop
It is entry controlled loop. That means condition is checked at the start of loop body. It is exit controlled loop. That means condition is checked at the end of loop body.
Loop body is not executed if condition is false. Loop body is executed once even if condition is false.
Generally not used for making menu driven programs. Generally used for making menu driven programs.





Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here