What happens when the for loop doesn't have any test condition ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What happens when the for loop doesn't have any test condition ?

will the programm executes till infinity or gives an error

12th Feb 2017, 2:54 PM
Krishan Nandan Goswami
Krishan Nandan Goswami - avatar
4 Answers
+ 11
It will run infinetly
12th Feb 2017, 3:10 PM
WittyBit
WittyBit - avatar
+ 2
if nothing "breaks" the loop it will run forever, no condition results to true so you have an infinite loop.
12th Feb 2017, 4:17 PM
Andre van Rensburg
Andre van Rensburg - avatar
+ 1
it will not stop
12th Feb 2017, 4:38 PM
Shubham chauhan
Shubham chauhan - avatar
+ 1
You cannot say that it will run infinitely (not for sure). You can have a break within your code or depending on this peace of code does, it can drain all memory and stop.
12th Feb 2017, 5:41 PM
Kleber Leal
Kleber Leal - avatar