rhai/doc/src/appendix/operators.md

54 lines
2.8 KiB
Markdown
Raw Normal View History

2020-07-08 06:09:18 +02:00
Operators and Symbols
====================
2020-06-21 18:03:45 +02:00
{{#include ../links.md}}
2020-07-08 06:09:18 +02:00
Operators
---------
2020-07-05 11:41:45 +02:00
| Operator | Description | Binary? | Binding direction |
| :---------------: | ------------------------------ | :-----: | :---------------: |
| `+` | Add | Yes | Left |
| `-` | Subtract, Minus | Yes/No | Left |
| `*` | Multiply | Yes | Left |
| `/` | Divide | Yes | Left |
| `%` | Modulo | Yes | Left |
| `~` | Power | Yes | Left |
| `>>` | Right bit-shift | Yes | Left |
| `<<` | Left bit-shift | Yes | Left |
| `&` | Bit-wise _And_, Boolean _And_ | Yes | Left |
| <code>\|</code> | Bit-wise _Or_, Boolean _Or_ | Yes | Left |
2020-07-06 07:01:57 +02:00
| `^` | Bit-wise _Xor_, Boolean _Xor_ | Yes | Left |
2020-07-05 11:41:45 +02:00
| `==` | 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 |
| `>=` | Greater than or equals to | Yes | Left |
| `&&` | Boolean _And_ (short-circuits) | Yes | Left |
| <code>\|\|</code> | Boolean _Or_ (short-circuits) | Yes | Left |
| `!` | Boolean _Not_ | No | Left |
| `[` .. `]` | Indexing | Yes | Right |
| `.` | Property access, Method call | Yes | Right |
2020-07-08 06:09:18 +02:00
Symbols
-------
| Symbol | Description |
| ------------ | ------------------------ |
| `:` | Property value separator |
| `::` | Module path separator |
2020-07-09 16:21:07 +02:00
| `#` | _Reserved_ |
2020-07-08 06:09:18 +02:00
| `=>` | _Reserved_ |
| `->` | _Reserved_ |
| `<-` | _Reserved_ |
| `===` | _Reserved_ |
| `!==` | _Reserved_ |
| `:=` | _Reserved_ |
| `::<` .. `>` | _Reserved_ |
| `@` | _Reserved_ |
| `(*` .. `*)` | _Reserved_ |