February 2014
Beginner
1248 pages
62h 25m
English
The initialization, loop-continuation condition and increment portions of a for statement can contain arithmetic expressions. For example, assume that x = 2 and y = 10. If x and y are not modified in the body of the loop, the statement
for (int j = x; j <= 4 * x * y; j += y / x)
is equivalent to the statement
for (int j = 2; j <= 80; j += 5)
The increment of a for statement may also be negative, in which case it’s a decrement, and the loop counts downward.
Read now
Unlock full access