What is difference between while and do-while loop? | SoloLearn: Learn to code for FREE!

-1

What is difference between while and do-while loop?

2/21/2017 8:31:47 AM

Md. Shifullah

2 Answers

New Answer

+1

Yeah this statement is correct The difference is in when the condition gets evaluated. In a do..while loop, the condition is not evaluated until the end of each loop. That means that ado..while loop will always run at least once. In a while loop, the condition is evaluated at the start.

+1

(my statement) do-while loop must execute for 1 time but while is not. because do-while loop execute code then check conditions but while loop check condition first then execute code.