17
Question Question 17
What are augmented assignment operators? How are they useful?
Answer
Augmented assignment operators combine the impact of an arithmetic operator with an assignment operator. For example, to add the value of b to the value of a and assign the result back to a then instead of writing:
a = a + b
we can write
a += b.
Augmented assignment operators are useful as they provide a shorthand way by combining the arithmetic and assignment operators.