Sage
Tusk Language
Welcome to Sage
Volume (47%) Hide Volume
Topics
Operators
The following table summarizes the operators in Tusk, and their precedence.

All binary operators associate left-to-right, except for the exponentiation operator, **, which is right-to-left.

Operator Arity Meaning
Level 0 (Highest)…
 . Binary Member Selection
 / Unary (Prefix) Topmost Identifier
 ^ Unary (Postfix) Pointer Dereference
 () Unary (Postfix) Function Call
 [] Unary (Postfix) Array / List Indexing
Level 1…
 @ Unary (Prefix) Address-Of
 @@ Unary (Prefix) Suppress Implicit Call
 not Unary (Prefix) Logical Negation / One's Complement
 + Unary (Prefix) Arithmetic Identity
 - Unary (Prefix) Arithmetic Negation
Level 2…
 ** Binary Exponentiation (right-associative)
Level 3…
 * Binary Multiplication
 / Binary Real Division
 div Binary Integer Division
 mod Binary Modulo
 and Binary Logical / Bitwise Conjunction
 shl Binary Shift Left
 shr Binary Shift Right
 as Binary Type Conversion
Level 4…
 + Binary Addition
 - Binary Subtraction
 or Binary Logical / Bitwise Disjunction
 xor Binary Logical / Bitwise Exclusive Disjunction
Level 5…
 = Binary Equals
 <> Binary Not Equals
 < Binary Less Than
 <= Binary Less Than or Equal
 > Binary Greater Than
 >= Binary Greater Than or Equal
 in Binary Member Of
 not in Binary Not Member Of
 is Binary Value Is Type
 is not Binary Value Is Not Type
Level 6 (Lowest)…
 if/then/else Ternary Conditional

Tusk's operators, their precedence, and their associativity, mirror Delphi's operators, with the addition of: Note: these three operators are not available in Delphi Mode.

Also, Tusk requires parentheses in some situations where Delphi does not.

Last Modified: 2/15 10:06:11 am
2/15 10:06:11 am