Does for loop iteration (3rd statement) make a difference if it is ++i over i++?
Im puzzled as to why the ++i doesnt skip the first statement in a for loop because it is supposed to change i=0 to i=1 before even using i itself. And to top it off when I use both ++i and i++ against each other I dont see a difference. Can someone explain why this is happening?
The order a for loop is executed is:
comparison, if true -> body -> increment -> repeat comparison
comparison, if false -> end
The increment is standalone, it's exactly the same as if you put
++i; or i++; on its own line somewhere else in the code.
The result of i is the same either way.