0
What is difference between while and do while in c#
2 ответов
+ 2
while is entry controlled loop
do while loop is exit controlled loop
entry controlled loop : check condition before entering to the loop.
exit controlled loop: check condition after reading the Statements with in the body of the do while loop.
+ 1
The difference between the two is that while...do loop controls the condition at the BEGINNING (before it starts), and do..while loop controls the condition at the END (after the first execution).
In other words we can say that while...do could be repeat neither once according to the condition and do...while MUST be executed at least once