| |
| Assignment operators actually work with
all the fundamental data types. |
| |
| The assignment operators |
| |
Description |
Operator |
| Simple |
= |
| Addition |
+= |
| Subtraction |
-= |
| Multiplication |
*= |
| Division |
/= |
| Modulus |
%= |
| AND |
&= |
| OR |
|= |
| XOR |
^= |
|
| |
| Examples: |
x += 6;
x *= (y - 3); |
| |
In the first example, x and 6 are added and the result stored in x.
In the second example, 3 is subtracted from y and the result is multiplied by x.
The final result is then stored in x |
|