Appendix B: Operators

Tokay implements the following operators for use in expressions. The operators are ordered by precedence, operators in the same row share the same precedence.

Operator Description Associativity
= += -= *= /= Assignment, combined operation-assignment left
|| Logical or left
&& Logical and left
== != < <= >= > Equal, unequal, Comparison left
+ - Add, subtract left
* / Multiply, divide left
- ! Negate, not right
++ -- Increment, decrement right
() [] . Grouping, subscript, attribute left

Operators produce different results depending on the data-types of their operands. For example, 3 * 10 multiplies 10 by 3, whereas 3 * "test" creates a new string repeating "test" 3 times. Try out the results of different operands in a Tokay REPL for clarification.