9.8 KiB
9.8 KiB
Operators and Symbols
{{#include ../links.md}}
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/exponentiation | yes | right |
>> |
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 | n/a |
== |
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 |
?? |
null-coalesce (short-circuits) | yes | left |
! |
boolean NOT | no | right |
[ ... ] , ?[ ... ] |
indexing | yes | left |
. , ?. |
1) property access 2) method call |
yes | left |
.. |
exclusive range | yes | left |
..= |
inclusive range | yes | left |
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] |
` ... ` |
back-tick | multi-line literal [string] |
' ... ' |
single quote | [character] |
\ |
1) escape 2) line continuation |
escape character literal |
() |
unit | null value |
( ... ) |
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 |
/// |
doc-comment | line [doc-comment] |
//! |
module doc | [module documentation][comments] |
/* ... */ |
comment | block comment |
/** ... */ |
doc-comment | block [doc-comment] |
(* ... *) |
comment | reserved |
#! |
shebang | reserved |
++ |
increment | reserved |
-- |
decrement | reserved |
... |
rest | reserved |
~ |
tilde | reserved |
!. |
reserved | |
? |
question | reserved |
# |
hash | reserved |
@ |
at | reserved |
$ |
dollar | reserved |
-> |
arrow | reserved |
<- |
left arrow | reserved |
<| |
left triangle | reserved |
|> |
right triangle | reserved |
=== |
strict equals to | reserved |
!== |
strict not equals to | reserved |
:= |
assignment | reserved |
:; |
typo to :: |
reserved |
::< ... > |
turbofish | reserved |