Skip to main content



Assignment

OperatorCompatible typesDescription
=AllAssigns the right-hand side value to the left-hand side, and returns the right-hand side value: ** ** var x = 45.6; ** ** Note that irScript values obey CLR assignment semantics (value types assign-by-value, reference types assign-by- reference… ScriptObject, ScriptCollection, and ScriptFunction are all reference types).
+ =Integer, Decimal, TextFor numerics, adds the lhs and rhs values and assigns the result to lhs. For text values, concatenates lhs with rhs and assigns the result to lhs. The resulting value is returned: ** ** var x = 45.6; x += 10;
-=Integer, DecimalSubtracts the lhs and rhs values and assigns the result to lhs. The resulting value is returned: ** ** var x = 45.6; x -= 10;
*=Integer, DecimalMultiplies the lhs and rhs values and assigns the result to lhs. The resulting value is returned: var x = 45.6; x -= 10;
/=Integer, DecimalDivides the lhs value by the rhs value and assigns the result to lhs. The resulting value is returned: var x = 45.6; x /= 10;
%=Integer, DecimalDivides the lhs value by the rhs value and assigns the remainder to lhs. The resulting value is returned: var x = 45; x %= 10;
&=IntegerPerforms a bitwise 'and' operation between lhs and rhs, and assigns the value to lhs. The resulting value is returned: ** ** var x = 4; x &= 3;
**=**Integer
^=IntegerPerforms a bitwise 'xor' operation between lhs and rhs, and assigns the value to lhs. The resulting value is returned: ** ** var x = 4; x ^= 3;
<<=IntegerShifts the lhs value by rhs bits to the left, and assigns the value to lhs. The resulting value is returned: ** ** var x = 45; x <<= 2;
>>=IntegerShifts the lhs value by rhs bits to the right, and assigns the value to lhs. The resulting value is returned: ** ** var x = 45; x >>= 2;