Can anyone show me the difference between for loop and while | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone show me the difference between for loop and while

For loop and while

19th Mar 2020, 3:15 PM
Makoye Ndalahwa
Makoye Ndalahwa - avatar
5 Answers
+ 2
A for loop will repeat a number of times indicated the instruction that you ask to do. Unlike a while loop that will repeat the instruction indefinitely as long as the condition is not fulfilled. if you have to make a loop but you don't know how many times you are going to pass and pass in it, you will have to make a while and not a for. 😃
19th Mar 2020, 3:45 PM
Jean_Mionnet
Jean_Mionnet - avatar
+ 1
Which language ?
19th Mar 2020, 3:29 PM
Jean_Mionnet
Jean_Mionnet - avatar
19th Mar 2020, 3:38 PM
Makoye Ndalahwa
Makoye Ndalahwa - avatar