Gentee Programming Language > Documentation > Syntax Download documentation

Assignment Operators

The assignment operators are considered to be the binary operators. The left-hand operand of an assignment operation must be an l-value. These operators have right-to-left associativity.
 
=Simple assignment
+=Addition assignment
-=Subtraction assignment
*=Multiplication assignment
/=Division assignment
%=Remainder assignment
&=Bitwise-AND assignment
|=Bitwise-inclusive-OR assignment
^=Bitwise-exclusive-OR assignment
>>=Right-shift assignment
<<=Left-shift assignment

As you have already noticed, except "simple assignment" you can perform the assignment with an operation, that is after a binary operation of the right-hand operand and the left-hand operand is performed, the result is assigned into the left operand.

a = 10
a += 33 // a = 43, is equivalent to a = a + 33

One and the same expression can contain several assignment operations, each of which returns the assigned value. In this case, the assignment operation is performed from right to left.

a = 10 + b = 20 + c = 3 // the result of expression evaluation is ñ=3, b=23, a=33

See also

    The As Operator, Type Redefinition    Table Of Operator Precedence


 Copyright © 2004-2006 Gentee Inc. All rights reserved.