What is the two main difference between while loop and do-while loop? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What is the two main difference between while loop and do-while loop?

21st Mar 2017, 11:58 AM
Sidhant Singh
Sidhant Singh - avatar
3 Antworten
+ 7
(while) - entry control loop i.e. starts executing if the condition is initially true. (do while) - exit control loop i.e. executes and checks the condition. That's why a do while loop always executes at least once.
21st Mar 2017, 12:02 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 1
the main difference is that the do-while, executes the block of code at least once, even if the condition is false.
21st Mar 2017, 12:02 PM
Welliton Malta
Welliton Malta - avatar
0
ok
21st Mar 2017, 12:05 PM
Sidhant Singh
Sidhant Singh - avatar