0
For and While loops
For loop with only the condition (statement 2 only ) is it like the while loop ? Ex : for (; i <10;)
1 Odpowiedź
+ 4
yes, it's exactly as you said. the code you provided is the same as a while loop hence why you need to increment the variable inside the loop else it will be an infinite loop. situations like this I would recommend using the while loop as it is more accustomed to it and makes more sense but either way will work.