Compound Assignment Operators

The autoincrement/decrement operators always add a constant 1 to the variable. We can make this an arbitrary value with the compound assignment operators:
     k += 5        =>    k = k + 5
     w -= 10       =>    w = w - 10
     x *= b        =>    x = x * b
     y /= a+b      =>    y = y / (a+b)
     n %= 10       =>    x = x % 10

     (also <<, >>, &, ^, | operators)
In general, these take the form
     <Lvalue> <op>= <expression>

equivalent to

     <Lvalue> = <Lvalue> <op> ( <expression> )


[up] to Overview.