|
2 | 2 |
|
3 | 3 | Nushell supports the following operators for common math, logic, and string operations:
|
4 | 4 |
|
5 |
| -| Operator | Description | |
6 |
| -| ------------- | ------------------------------------------------------- | |
7 |
| -| `+` | add | |
8 |
| -| `-` | subtract | |
9 |
| -| `*` | multiply | |
10 |
| -| `/` | divide | |
11 |
| -| `//` | floor division | |
12 |
| -| `mod` | modulo | |
13 |
| -| `**` | exponentiation (power) | |
14 |
| -| `==` | equal | |
15 |
| -| `!=` | not equal | |
16 |
| -| `<` | less than | |
17 |
| -| `<=` | less than or equal | |
18 |
| -| `>` | greater than | |
19 |
| -| `>=` | greater than or equal | |
20 |
| -| `=~` | regex match / string contains another | |
21 |
| -| `!~` | inverse regex match / string does *not* contain another | |
22 |
| -| `in` | value in list | |
23 |
| -| `not-in` | value not in list | |
24 |
| -| `not` | logical not | |
25 |
| -| `and` | and two Boolean expressions (short-circuits) | |
26 |
| -| `or` | or two Boolean expressions (short-circuits) | |
27 |
| -| `xor` | exclusive or two boolean expressions | |
28 |
| -| `bit-or` | bitwise or | |
29 |
| -| `bit-xor` | bitwise xor | |
30 |
| -| `bit-and` | bitwise and | |
31 |
| -| `bit-shl` | bitwise shift left | |
32 |
| -| `bit-shr` | bitwise shift right | |
33 |
| -| `starts-with` | string starts with | |
34 |
| -| `ends-with` | string ends with | |
35 |
| -| `++` | append lists | |
| 5 | +| Operator | Description | |
| 6 | +| ------------------ | ------------------------------------------------------- | |
| 7 | +| `+` | add | |
| 8 | +| `-` | subtract | |
| 9 | +| `*` | multiply | |
| 10 | +| `/` | divide | |
| 11 | +| `//` | floor division | |
| 12 | +| `mod` | modulo | |
| 13 | +| `**` | exponentiation (power) | |
| 14 | +| `==` | equal | |
| 15 | +| `!=` | not equal | |
| 16 | +| `<` | less than | |
| 17 | +| `<=` | less than or equal | |
| 18 | +| `>` | greater than | |
| 19 | +| `>=` | greater than or equal | |
| 20 | +| `=~` or `like` | regex match / string contains another | |
| 21 | +| `!~` or `not-like` | inverse regex match / string does *not* contain another | |
| 22 | +| `in` | value in list | |
| 23 | +| `not-in` | value not in list | |
| 24 | +| `has` | list has value | |
| 25 | +| `not-has` | list does not have value | |
| 26 | +| `not` | logical not | |
| 27 | +| `and` | and two Boolean expressions (short-circuits) | |
| 28 | +| `or` | or two Boolean expressions (short-circuits) | |
| 29 | +| `xor` | exclusive or two boolean expressions | |
| 30 | +| `bit-or` | bitwise or | |
| 31 | +| `bit-xor` | bitwise xor | |
| 32 | +| `bit-and` | bitwise and | |
| 33 | +| `bit-shl` | bitwise shift left | |
| 34 | +| `bit-shr` | bitwise shift right | |
| 35 | +| `starts-with` | string starts with | |
| 36 | +| `ends-with` | string ends with | |
| 37 | +| `++` | append lists | |
36 | 38 |
|
37 | 39 |
|
38 | 40 | Parentheses can be used for grouping to specify evaluation order or for calling commands and using the results in an expression.
|
|
0 commit comments