Assignment Operators

These are operators that assign values to variables. They often use bitwise or arithmetic operators during assignment.

Name Maths Operator Example Note
Simple assignment x=y = x = y
Addition assign x=x+y += x += y
Subtraction assign x=xy -= x -= y
Multiplication assign x=x×y *= x *= y
Division assign x=x÷y /= x /= y Division by zero will throw an exception.
Modulus assign x=xmody %= x %= y
Bitwise AND assign x=xy &= x &= y
Bitwise OR assign x=xy |= x |= y
Bitwise XOR assign x=xy ^= x ^= y
Left shift assign x=x<<n <<= x <<= n
Right shift assign x=x>>n >>= x >>= n