Addition Assignment(+=) |
Sums up left and right operand values and then assign the result to the left operand. |
Y += 1 gives Y = Y + 1 |
Subtraction Assignment(-=) |
Subtract right side value from left side value and then assign the result to the left operand. |
Y -= 1 gives Y = Y - 1 |
Multiplication Assignment(*=) |
Multiplies a variable by the value of the right operand and assigns the result to the variable. |
Y *= A is equivalent to Y = Y * A |
Division Assignment(/=) |
Divides a variable by the value of the right operand and assigns the result to the variable. |
Y /= A is equivalent to Y = Y / A |
Modulus Assignment(%=) |
Divides a variable by the value of the right operand and assigns the remainder to the variable. |
Y %= A is equivalent to Y = Y % A |
Exponentiation Assignment (** =) |
Raise the Left operator to the power of the right operator. |
Y = 5 ** 3 gives Y = 125 |
Left Shift Assignment (<<=) |
Moves the specified amount of bits to the left and assigns the result to the variable. |
Y <<= A is equivalent to Y=Y << A |
Right Shift Assignment (>> =) |
Moves the specified amount of bits to the right and assigns the result to the variable. |
Y >>= A is equivalent to Y = Y >> A |
Bitwise AND Assignment (& =) |
Does a bitwise AND operation on the operand, and assigns the result to the variable. |
Y &= b is equivalent to Y = Y & A |
Bitwise OR Assignment (| =) |
Does a bitwise OR operation on the operand, and assigns the result to the variable. |
Y |= A is equivalent to Y= Y | b |
Bitwise XOR Assignment (^ =) |
Does a bitwise XOR operation on the operand, and assigns the result to the variable. |
Y ^= A is equivalent to Y= Y ^ A |