5 views

1 Answers

Augmented assignment is the name given to certain assignment operators in certain programming languages. An augmented assignment is generally used to replace a statement where an operator takes a variable as one of its arguments and then assigns the result back to the same variable. A simple example is x += 1 which is expanded to x = x +. Similar constructions are often available for various binary operators.

In general, in languages offering this feature, most operators that can take a variable as one of their arguments and return a result of the same type have an augmented assignment equivalent that assigns the result back to the variable in place, including arithmetic operators, bitshift operators, and bitwise operators.

5 views

Related Questions