How does += (plus equal) work?

1 += 2 is a syntax error (left-side must be a variable).

x += y is shorthand for x = x + y.

Leave a Comment