X# uses the following Assignment operators:
Operator |
Example |
Meaning |
:= |
x := y |
Store the value of the second operand in the object specified by the first operand (simple assignment). |
= |
x = y |
Store the value of the second operand in the object specified by the first operand (simple assignment). |
+= |
x += y |
Add the value of the second operand to the value of the first operand; store the result in the object specified by the first operand |
-= |
x -= y |
Subtract the value of the second operand from the value of the first operand; store the result in the object specified by the first operand. |
/= |
x /= y |
Divide the value of the first operand by the value of the second operand; store the result in the object specified by the first operand |
%= |
x %= y |
Take modulus of the first operand specified by the value of the second operand; store the result in the object specified by the first operand. |
*= |
x *= y |
Multiply the value of the first operand by the value of the second operand; store the result in the object specified by the first operand. |
^= or **= |
x ^= y |
Calculate the exponent of the first operand and the second operand ; store the result in the object specified by the first operand. |
|= |
x |= y |
Obtain the bitwise inclusive OR of the first and second operands; store the result in the object specified by the first operand. |
&= |
x &= y |
Obtain the bitwise AND of the first and second operands; store the result in the object specified by the first operand. |
~= |
x ~= y |
Obtain the bitwise exclusive OR of the first and second operands; store the result in the object specified by the first operand. |
<<= |
x <<= y |
Shift the value of the first operand left the number of bits specified by the value of the second operand; store the result in the object specified by the first operand. |
>>= |
x >>= y |
Shift the value of the first operand right the number of bits specified by the value of the second operand; store the result in the object specified by the first operand. |
?= |
a ?= "somevalue" |
When a is NULL then it will be assigned "somevalue". Otherwise a is not changed |
See the topic about Binary operators to see which complex assignment operators are supported.