Where can we apply this do...while loop and other loops?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Where can we apply this do...while loop and other loops??

6th Jul 2016, 6:14 AM
Navigator Moses
Navigator Moses - avatar
10 Answers
+ 1
Oh
7th Jul 2016, 3:41 AM
Corrupted_XYZ
Corrupted_XYZ - avatar
+ 1
Well, in different codes, i.e. Counter from 1 to 10.
7th Jul 2016, 3:42 AM
Corrupted_XYZ
Corrupted_XYZ - avatar
+ 1
haven't gotten you megacreator458
7th Jul 2016, 12:21 PM
Navigator Moses
Navigator Moses - avatar
+ 1
do while is used when you want to execute something one time and after that execute it again if the condition is true, for example : do{x++;}while(x < 5) will execute x++ one time. then it will check condition of while and execute the loop again if it is true.
7th Jul 2016, 3:30 PM
Slim Sa
Slim Sa - avatar
0
What are you talking about
7th Jul 2016, 3:41 AM
Corrupted_XYZ
Corrupted_XYZ - avatar
0
what about other loops but still I want to know , where to apply them and not how.!
7th Jul 2016, 4:20 PM
Navigator Moses
Navigator Moses - avatar
0
checking conditions for n times..and for iteration..
11th Jul 2016, 6:03 AM
Selva Subha Sree
0
you can apply them when u need a part of code to execute 'n' times. same goes for the other loops. that's why they're called "loops"
24th Jul 2016, 2:12 AM
Slim Sa
Slim Sa - avatar
0
Do while executes the block of code atleast once even if ur condition results in false
1st Aug 2016, 6:54 AM
Sumitabha Banerjee
Sumitabha Banerjee - avatar
0
If you don't know in advance how many times you will need to run a loop, but you know it needs to run at least once, use do/while. An example would be if you had a program flipping a virtual coin until you get heads. You don't know how many times it will need to run, but it has to run once and then run while you are getting tails.
4th Sep 2016, 9:27 PM
Felix