+ 1

What is the difference between for loop and while loop? Are both loops irritation loops?

19th Jun 2016, 9:06 PM
Rashad
Rashad - avatar
2 ответов
+ 1
a while loop is usually used when you don't know or can't know until execution how many times your code is going to be executed. say you have a program that returns to a menu every time the person executes an action. you can't know how many times the person is going to be coming back to the main menu, so it's easier to use a while loop
20th Jun 2016, 7:20 AM
Matheus Fernandes
Matheus Fernandes - avatar
0
a for loop is used to do something a certain number of times, our middle condition. a while loops is used to do something until a certain condition is met but we don't know how long it will take for that to occur
19th Jun 2016, 10:36 PM
destro