+ 2
How do I know which loops to use?
Whenever I get a programming exercise, I have difficulty with selecting which loop to use. Do you having any tips or guidelines I could use to select the right loop to use?
5 ответов
+ 5
When you know the number of iterations then use FOR LOOP. When you don't know the number of iterations then use WHILE LOOP. Use DO WHILE LOOP if you feel that something has to be executed atleast once.
For conditional statements you can replace your 'IF ELSE' ladder with SWITCH.
+ 6
//If you see course on java its nicely mentioned how and where to use this loops while,for and do while
https://www.sololearn.com/learn/Java/2146/
https://www.sololearn.com/learn/Java/2147/
https://www.sololearn.com/learn/Java/2206/
+ 5
If you familiar with c or c++ then easily understood that but if you don't know c/c++ then show videos by Durga sir on YouTube.
+ 3
Avinesh thank you for that tip.. I will definitely use that
+ 2
Sudarshan Rai 👑 thank you, I'll surely check them out