Why can't I create an infinite loop using for loop if I omit the second statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why can't I create an infinite loop using for loop if I omit the second statement?

https://code.sololearn.com/cblRXi1esb6N/?ref=app

13th Jul 2018, 8:49 AM
Gravenclaw_Waveward
Gravenclaw_Waveward - avatar
3 Answers
+ 3
It's better to use the while statement if you are looking for an infinite loop.
13th Jul 2018, 9:45 AM
Wimme Dg
Wimme Dg - avatar
+ 1
Yash The second statement, is the control statement. In other words, it's what determines whether the loop continues to run or not. If you omit, there's nothing to check if the loop should run at all
13th Jul 2018, 9:30 AM
Dlite
Dlite - avatar
0
Hi Yash, Would you mind posting your code to Code Playground and linking here so we can have a better idea of what you're asking, please?
13th Jul 2018, 9:06 AM
Janningā­
Janningā­ - avatar