for
and while
and semicolonsA common mistake is to have a stray semicolon. Instead of
i = 0; while ( i < 100 ) i++;
you write
i = 0; while ( i < 100 ); i++;
The while
executes an empty statement because of the semicolon, and the i++
is never executed.