Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module.exports = {
"configuration",
"custom_commands",
"aliases",
"operators",
"math",
"variables_and_invocations",
"environment",
Expand Down
3 changes: 2 additions & 1 deletion book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [Configuration](configuration.md) - How to configure nushell
* [Custom commands](custom_commands.md) - Creating your own commands
* [Aliases](aliases.md) - How to alias commands
* [Operators](operators.md) - Operators supported by nushell
* [Math](math.md) - Math operations in nushell
* [Variables and invocations](variables_and_invocations.md) - Variables and invocations
* [Environment](environment.md) - Working with environment variables
Expand All @@ -23,4 +24,4 @@
* [Nushell map from imperative languages](nushell_map_imperative.md) - A guide to help understand how nushell compares with Python, Kotlin, C++, C# and Rust. Contributions welcome.
* [Nushell map from functional languages](nushell_map_functional.md) - A guide to help understand how nushell compares with Clojure, Tablecloth (Ocaml / Elm) and Haskell. Contributions welcome.
* [Nushell operator map](nushell_operator_map.md) - A guide to help understand operators.
* [Command Reference](command_reference.md) - A list of all Nushell's commands.
* [Command Reference](command_reference.md) - A list of all Nushell's commands.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the change is on this line.

33 changes: 33 additions & 0 deletions book/operators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Operators

Nushell supports the following operators:

| Operator | Description |
| -------- | ------------------------------- |
| `+` | add |
| `-` | subtract |
| `*` | multiply |
| `/` | divide |
| `**` | exponentiation (power) |
| `mod` | modulo |
| `==` | equal |
| `!=` | not equal |
| `<` | less than |
| `<=` | less than or equal |
| `>` | greater than |
| `>=` | greater than or equal |
| `=~` | string contains another |
| `!~` | string does not contain another |
| `in` | value in list |
| `not in` | value not in list |
| `&&` | and two Boolean values |
| `||` | or two Boolean values |

Parentheses can be used for grouping to specify evaluation order.
Operators can only be used in "math mode".
An expression is in math mode if it begins with `=`.
Commands that take a boolean expression, such as
`where`, `keep while`, `keep until`, `skip while`, and `skip util`,
are automatically evaluated in math mode.

For example, `let a = 2; let b = 3; = $a * $b` outputs `6`.
3 changes: 2 additions & 1 deletion book/table_of_contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [Pipeline](pipeline.md) - How the pipeline works
* [Configuration](configuration.md) - How to configure Nu
* [Aliases](aliases.md) - Aliases for blocks of commands
* [Operators](operators.md) - Operators supported by nushell
* [Math](math.md) - Math operations in Nu
* [Environment](environment.md) - Working with environment variables
* [Metadata](metadata.md) - An explanation of Nu's metadata system
Expand All @@ -19,4 +20,4 @@
* [Nu map from shells/DSL](nushell_map.md) - Guide to show how Nu compares to SQL, Linq/C#, PowerShell and Bash
* [Nu map from imperative languages](nushell_map_imperative.md) - Guide to show how Nu compares to Python, Kotlin, C++ and Rust
* [Nu map from functional languages](nushell_map_functional.md) - Guide to show how Nu compares to Clojure, Tablecloth (Ocaml / Elm) and Haskell
* [Nu operator map](nushell_operator_map.md) - Guide to show how Nu compares to operators in general purpose programming languages
* [Nu operator map](nushell_operator_map.md) - Guide to show how Nu compares to operators in general purpose programming languages
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the change is on this line.