Potential Infinite Loop!

The loop control statement - the part in parentheses after the for keyword - is a notational convenience that allows three expressions commonly needed for looping to be written together - the three expressions still have to be valid statements on their own - e.g. an update to any variable in the third expression requires an assignment say i=i + 1 or i+=1 or ++i etc - the control statement only controls when each of the three expressions is executed relative to the body of the loop

This is fleshed out in the post below

1 Like