Operator precedence
The following list orders the Gosu operators from highest to lowest precedence. Gosu evaluates operators with the same precedence from left to right. The use of parentheses can modify the evaluation order as determined by operator precedence. Gosu first evaluates an expression within parentheses, then uses that value in evaluating the remainder of the expression.
Operator |
Description |
|---|---|
|
Property access, array indexing, function calls and expression grouping. The operators with the question marks are the null-safe operators. |
|
Object creation, object reflection. |
|
Array value list, as in {value1, value2, value3} Argument list, as in (parameter1, parameter2, parameter3) |
|
Casting a value to a specific type. |
|
Unary operands for positive value and negative value. |
|
Bit-wise |
|
Determine if an object is a specific type or subtype. |
|
Multiplication, division, modulo division. |
|
Bitwise shifting. |
|
Addition, subtraction, string concatenation. The versions with the question marks are the null-safe versions. |
|
Less than, less than or equal, greater than, greater than or equal |
|
Equality and inequality operators for values and references. |
|
Bitwise |
|
Bitwise exclusive |
|
Bitwise inclusive |
|
Logical |
|
Logical |
|
Ternary conditional. For example: Null-safe default operator |
|
Assignment operator statements. These operators apply to Gosu statements, not expressions. |
See also
