Compound Assignment Operators
For statement in this form:
variable = variable op expression;
we may write:
variable op= expression;
Examples:
c += 7; equivalent to c = c + 7;
d -= 4; d = d - 4;
e *= 5; e = e * 5;
f /= 3; f = f / 3;
g %= 9; g = g % 9;
Previous slide
Next slide
Back to first slide
View graphic version