In looping process. What is the different between while loop & do while loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In looping process. What is the different between while loop & do while loop?

10th Mar 2018, 1:31 PM
Sujan Sharma
Sujan Sharma - avatar
4 Answers
+ 11
while loop is an entry-control loop i.e. it will check the condition provided before entering the loop. On the other hand, do..while is an exit-control loop, it run the loop once then checks the conditions to ensure if it will do next iteration. Do..while will run the loop once even if condition met false
10th Mar 2018, 1:38 PM
Kartikey Sahu
Kartikey Sahu - avatar
+ 14
https://www.sololearn.com/Discuss/496089/?ref=app https://www.sololearn.com/Discuss/344091/?ref=app //do while loop will execute atleast once even if condition is false as condition is checked after a iteration in do while() loop
10th Mar 2018, 1:35 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
While loop: If the condition is false, code will not run Do while loop: If the condition is false, code run only ONCE
10th Mar 2018, 1:34 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
10th Mar 2018, 1:33 PM
Harjeet Singh
Harjeet Singh - avatar