+ 2

What's different between "for" and "while"?

13th Sep 2017, 1:50 PM
Asemay
Asemay - avatar
4 Respostas
13th Sep 2017, 5:54 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
https://www.quora.com/What-is-the-difference-between-while-loop-and-for-loop-What-is-an-example-of-this
13th Sep 2017, 2:01 PM
Kamil
Kamil - avatar
+ 1
thanks for yours answer
13th Sep 2017, 2:55 PM
Asemay
Asemay - avatar
0
Basically, the "while(condition){}" works all the time while the condition is true. The "for(variable, condition, increment){}" works only a determinated time. When the loop complete a "cicle", the variable increase. When the variable reaches the condition (changing the condition to "false") the loop ends and continue with the rest of the code.
13th Sep 2017, 2:33 PM
Max Sepúlveda
Max Sepúlveda - avatar