for (a; b; c) d;
The first clause of the for-loop is the initialization, the second is the boolean expression that is the condition, the third is the increment.
Keep in mind that the increment occurs at the end of each iteration. So, in general, the conversion of that generic for-loop to a generic while-loop is this:
a; while (b) d; c;
Or I could label it like this:
for (initialization; condition; increment) doStuff();
is the same as:
initialization; while (condition) doStuff(); increment;
However, there are some minor differences:
continue
wouldn't work correctly because in the while-loop example, it would skip over the increment, which doesn't happen in a for-loop
Created: March 7, 2014
Last Updated: August 16, 2014
Completed in full by: Michael Yaworski