2005/5/9

     
 

CfgScript Assignment Expressions

artefaktur

| Literals | Assigment | Operator | Instanceof | Delegates | Lambda |

Assignment bind values to a variable



AssignmentExpression
: LValue '='  Expression
;

LValue
: Identifier
| ClassOrObjectMember
;
Assign a new value to a variable.

Although the assignment operation will be used in most cases as statement (a = 2;) it is an expression. The result of the expression is value of the variable.
Different to many other operations the assignment will be evaluated from the right to the left so chained assignments are possible:

a = b = 4; // both a and b contains 4

Please refer also to  Variable Declaration