Which is Efficient and fast! while, do-while or for loop ? | SoloLearn: Learn to code for FREE!

0

Which is Efficient and fast! while, do-while or for loop ?

8/14/2016 6:00:31 AM

Ashish Kumar

2 Answers

New Answer

+2

Depends on the code and situation. Explain or provide an example. most often then not you can make each one work for you however choose the one that makes sense to you. if you want a nested loop and know how many time to reiterate use for loop. if you need to at least run the function once regardless if the condition is met run the do while and if you want to only run the code if a condition is met do a while loop.

-1

they have different reasons to use. its not about efficiency