Operators
The articles in this section specify the usable operators in the language.
Precedence table
The following table defines the order of evaluation when multiple operators present in an expression.
| Operator | Reference | |
|---|---|---|
| Evaluated first | (expr) | Parentheses |
$expr | Dereference | |
[idx] | Subscript | |
~ - ! | Bitwise negate, Unary minus, Boolean negate | |
* / % | Mathematic operators | |
+ - | Addition, Mathematic operators | |
<< >> | Bitwise shift operators | |
< <= >= > | Numeric comparison | |
== != | Equality comparison | |
& | Bitwise operators | |
^ | Bitwise operators | |
| | Bitwise operators | |
&& | Boolean operators | |
|| | Boolean operators | |
cond ? tv : fv | Ternary | |
| Evaluated last | var = expr | Assignment |
Syntax lookup
The following operators are available in the language based on their syntax:
(expression)- Parentheses$expression- Dereferenceleft = value- Assignmentsubject[index]- Subscriptlist + list- Additionmap + map- Additionnumber + number- Mathematic operatorsnumber - number- Mathematic operatorsnumber * number- Mathematic operatorsnumber / number- Mathematic operatorsnumber % number- Mathematic operatorsboolean && boolean- Boolean operatorsboolean || boolean- Boolean operators!boolean- Boolean negateleft == right- Equality comparisonleft != right- Equality comparisonnumber > number- Numeric comparisonnumber >= number- Numeric comparisonnumber < number- Numeric comparisonnumber <= number- Numeric comparisoncondition ? trueval : falseval- Ternary-number- Unary minus~number- Bitwise negatenumber | number- Bitwise operatorsnumber ^ number- Bitwise operatorsnumber & number- Bitwise operatorsnumber << shift- Bitwise shift operatorsnumber >> shift- Bitwise shift operators