do while loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

do while loop

what is the application of do while loop ?

30th Jun 2017, 5:00 AM
Abhishek Regmi
Abhishek Regmi - avatar
2 Answers
+ 8
When you want a block of code to execute at least once. There are times when such cases are compulsory, e.g. do { // randomly initialize an empty variable } while (// variable is not within a range);
30th Jun 2017, 5:27 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
It will run the code and then check the condition to execute code, if condition is true.
1st Jul 2017, 12:56 PM
Rakesh Purohit
Rakesh Purohit - avatar