Vikari supports the following binary assignment operators:
Operator Name | Symbol | Function |
---|---|---|
Left Assignment | << | Assign the right operand to the left operand. |
Right Assignment | >> | Assign the left operand to the right operand. |
Assignment operators are used in variable declaration statements, and assignment expressions.
The left assignment operator << assigns the right operand to the left operand. The left operand must be a variable. If the variable does not yet exist, a new variable can be declared and assigned at the same time using this operator.
The right assignment operator >> assigns the left operand to the right operand. The right operand must be a variable. If the variable does not yet exist, a syntax error will be thrown.
Assignment operator expressions return the result of the value being assigned. They can therefore be used anywhere an expression of that resulting type is then allowed. Chaining of left assignment operators is allowed without a grouping. However, due to right-associativity of right assignment operators, a grouping is then necessary for chaining them together.