0
Which is Efficient and fast! while, do-while or for loop ?
2 odpowiedzi
+ 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