Operators and Symbols
Operators
Operator | Description | Binary? | Binding direction |
---|---|---|---|
+ | add | yes | left |
- | 1) subtract 2) negative (prefix) | yes no | left right |
* | multiply | yes | left |
/ | divide | yes | left |
% | modulo | yes | left |
~ | power | yes | left |
>> | right bit-shift | yes | left |
<< | left bit-shift | yes | left |
& | 1) bit-wise AND 2) boolean AND | yes | left |
| | 1) bit-wise OR 2) boolean OR | yes | left |
^ | 1) bit-wise XOR 2) boolean XOR | yes | left |
= , += , -= , *= , /= ,~= , %= , <<= , >>= , &= ,|= , ^= | assignments | yes | right |
== | equals to | yes | left |
~= | not equals to | yes | left |
> | greater than | yes | left |
>= | greater than or equals to | yes | left |
< | less than | yes | left |
<= | less than or equals to | yes | left |
&& | boolean AND (short-circuits) | yes | left |
|| | boolean OR (short-circuits) | yes | left |
! | boolean NOT | no | left |
[ .. ] | indexing | yes | right |
. | 1) property access 2) method call | yes | right |
Symbols and Patterns
Symbol | Name | Description |
---|---|---|
_ | underscore | default switch case |
; | semicolon | statement separator |
, | comma | list separator |
: | colon | object map property value separator |
:: | path | module path separator |
#{ .. } | hash map | object map literal |
" .. " | double quote | string |
' .. ' | single quote | character |
\ | escape | escape character literal |
( .. ) | parentheses | expression grouping |
{ .. } | braces | block statement |
| .. | | pipes | closure |
[ .. ] | brackets | array literal |
! | bang | function call in calling scope |
=> | double arrow | switch expression case separator |
// | comment | line comment |
/* .. */ | comment | block comment |
(* .. *) | comment | reserved |
< .. > | angular brackets | reserved |
++ | increment | reserved |
-- | decrement | reserved |
.. | range | reserved |
... | range | reserved |
** | exponentiation | reserved |
# | hash | reserved |
@ | at | reserved |
$ | dollar | reserved |
-> | arrow | reserved |
<- | left arrow | reserved |
=== | strict equals to | reserved |
!== | strict not equals to | reserved |
:= | assignment | reserved |
::< .. > | turbofish | reserved |