Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Compound assignment operators are shorthand notations that combine an arithmetic operation with the assignment operator. They allow you to perform an operation and assign the result to a variable in a single step.
This operator adds the value on the right side of it to the variable on the left side, and then assigns the result back to that variable.
-= operator: This operator subtracts the value on the right side of it from the variable on the left side, and then assigns the result back to that variable.