+ 10

What is difference between loops?

do ... while loop and while loop are almost same, only difference is in their framework. Is there anymore diffference?

14th Dec 2021, 9:26 AM
purveshKolhe
purveshKolhe - avatar
9 Réponses
+ 3
While loop is an entry control loop It is used when no of iterations are not known But loop has to continue until certain condition is satisfied Syntax while(condition) { [statements]; [inc/dec]; } Do while loop is an exit control loop This loop executes statements atleast once with independence of condition check This is used to create menu driven programming Syntax do { [statements]; [inc/dec]; } while(condition);
15th Dec 2021, 8:13 AM
sree harsha
sree harsha - avatar
+ 6
Do while run atleast one time even if condition is false.
14th Dec 2021, 9:29 AM
Commander Erwin Smith
Commander Erwin Smith - avatar
14th Dec 2021, 9:33 AM
Commander Erwin Smith
Commander Erwin Smith - avatar
+ 4
It is all the same
15th Dec 2021, 11:23 PM
Segonia
Segonia - avatar
+ 4
The While loop is while (cond) { //code } While the Do...while loop is do { //code } while (cond) But does the same thing
20th Dec 2021, 10:30 AM
Segonia
Segonia - avatar
+ 3
Is that the only difference? Nevertheless, thanks for your help! Harsh Gaur
14th Dec 2021, 9:30 AM
purveshKolhe
purveshKolhe - avatar
+ 3
This meme can also demonstrate while vs do-while 😆 https://www.sololearn.com/post/1425077/?ref=app
14th Dec 2021, 10:04 AM
Anannya
+ 3
difference between loop is syntax, defination, structure,
20th Dec 2021, 8:59 AM
Yamima Thapa
Yamima Thapa - avatar
+ 1
Yes bro what they said absolutely correct . Nice
15th Dec 2021, 6:07 PM
GODDUMURI RAJU
GODDUMURI RAJU - avatar