Operators
editOperators
editAn operator is the most basic action that can be taken to evaluate values in a script. An expression is one-to-many consecutive operations. Precedence is the order in which an operator will be evaluated relative to another operator. Associativity is the direction within an expression in which a specific operator is evaluated. The following table lists all available operators:
Operator |
Category |
Symbol(s) |
Precedence |
Associativity |
() |
0 |
left → right |
||
. () |
1 |
left → right |
||
. |
1 |
left → right |
||
?. |
1 |
left → right |
||
() |
1 |
left → right |
||
[] {} |
1 |
left → right |
||
[] |
1 |
left → right |
||
. |
1 |
left → right |
||
[] |
1 |
left → right |
||
[] |
1 |
left → right |
||
[:] |
1 |
left → right |
||
[] |
1 |
left → right |
||
++ |
1 |
left → right |
||
— |
1 |
left → right |
||
++ |
2 |
right → left |
||
— |
2 |
right → left |
||
+ |
2 |
right → left |
||
- |
2 |
right → left |
||
! |
2 |
right → left |
||
~ |
2 |
right → left |
||
() |
3 |
right → left |
||
new () |
3 |
right → left |
||
new [] |
3 |
right → left |
||
* |
4 |
left → right |
||
/ |
4 |
left → right |
||
% |
4 |
left → right |
||
+ |
5 |
left → right |
||
+ |
5 |
left → right |
||
- |
5 |
left → right |
||
<< |
6 |
left → right |
||
>> |
6 |
left → right |
||
>>> |
6 |
left → right |
||
> |
7 |
left → right |
||
>= |
7 |
left → right |
||
< |
7 |
left → right |
||
⇐ |
7 |
left → right |
||
instanceof |
8 |
left → right |
||
== |
9 |
left → right |
||
!= |
9 |
left → right |
||
=== |
9 |
left → right |
||
!== |
9 |
left → right |
||
& |
10 |
left → right |
||
^ |
11 |
left → right |
||
^ |
11 |
left → right |
||
| |
12 |
left → right |
||
&& |
13 |
left → right |
||
|| |
14 |
left → right |
||
? : |
15 |
right → left |
||
?: |
16 |
right → left |
||
= |
17 |
right → left |
||
$= |
17 |
right → left |