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 |
||
| Addition assign | += |
x += y |
||
| Subtraction assign | -= |
x -= y |
||
| Multiplication assign | *= |
x *= y |
||
| Division assign | /= |
x /= y |
Division by zero will throw an exception. | |
| Modulus assign | %= |
x %= y |
||
| Bitwise AND assign | &= |
x &= y |
||
| Bitwise OR assign | |= |
x |= y |
||
| Bitwise XOR assign | ^= |
x ^= y |
||
| Left shift assign | <<= |
x <<= n |
||
| Right shift assign | >>= |
x >>= n |
||