0

For and While loops

For loop with only the condition (statement 2 only ) is it like the while loop ? Ex : for (; i <10;)

25th Jan 2017, 2:58 PM
Omar Boulbaze
1 Antwort
+ 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.
25th Jan 2017, 3:18 PM
Ousmane Diaw