0
is do...while(condition) more advantageous than while(true)...if(!condition)break?
I never use do...while because I can use if()break to make a loop (or part of one) run at least once. would using do...while for efficiency be worth the lack of modifiability?
3 Answers
+ 5
do while loop is good if you want to execute a block of codes at least once and then only check the condition. It's normally used for data validation to ask user input and then check if user input the correct data.
+ 1
Actually do while conditions is better in palace where u want to give the demo then u should use the do while
0
you may also you for loop and put your condition in the middle of the for loop.