Operator |
Description |
Example |
---|---|---|
= |
Assigns values |
x=y |
+= |
Adds the right operand to the left operand and assigns the result to the left operand |
x +=y (same as x = x+y) |
-= |
Subtracts the right operand from the left operand and assigns the result to the left operand |
y -=x (same as y=y-x) |
*= |
Multiplies the right operand by the left operand and assigns the result to the left operand |
x *= a (same as x = x * a) |
/= |
Divides the left operand by the right operand and assigns the result to the left operand |
x /= a (same as x = x / ax) |
%= |
Performs a modulus on operators and assigns the result to the left operand |
x %= a (same as x = x % a) |
**= |
Performs an exponential (power) calculation on operators and assigns the result to the left operand |
x **= a (same as x = x ** a) |