Assignment with Calculation¶
Combined Operators¶
The long way
i = i + 2;
arr[j] = arr[j] + 2;
The short way
i += 2;
arr[j] += 2;
Less writing (⟶ confusion)
Expression evaluated only once ⟶ performance
Applies to
+
,-
,*
,/
,%
,<<
,>>
,&
,^
,|