+ 1
I'm seeing: += a lot. What does it mean?
4 Answers
+ 22
It means sum and assignment. Example:
a = 1;
a += 1; // result: a == 2
It is the same as:
a = a + 1;
+ 18
x += 5 is shorthand of x = x + 5
+ 2
Thank you so much for your quick response!
+ 1
That's an assignment operator,
which assign sum of left and right operands to left one.
So x += y is equivalent to x = x + y.
These are similar operators:
-= *= /= %= etc...