|1 doesn't equal 10 |
Not the correct explanation.
statement is moved out of the loop, where it belongs, an infinite loop results.
First i is initialised with the value 1.
Then the expression
is evaluated to see whether it is true or false. First, the assignment operation is performed, so i is set to the value 10. Then the result, 10, becomes the result of the expression. In a boolean test, zero is considered
and any non-zero value is interpreted as
After the first pass through the loop, i is incremented via the
operation, and the condition is tested again as above, and i is set to 10 again.
Thus the loop is executed over and over again with exactly the same values.