Skip to content

Commit

Permalink
Remove $nothing (nushell#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
kit494way authored Feb 4, 2024
1 parent 2a0862e commit eb262be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion book/dataframes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ command categories.
| is-duplicated | Series | Creates mask indicating duplicated values | |
| is-in | Series | Checks if elements from a series are contained in right series | in |
| is-not-null | Series | Creates mask where value is not null | |
| is-null | Series | Creates mask where value is null | `<column_name> == $nothing` |
| is-null | Series | Creates mask where value is null | `<column_name> == null` |
| is-unique | Series | Creates mask indicating unique values | |
| join | DataFrame | Joins a dataframe using columns as reference | |
| last | DataFrame | Creates new dataframe with last rows | last |
Expand Down
2 changes: 1 addition & 1 deletion book/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ An example for PWD env change hook:
$env.config = ($env.config | upsert hooks.env_change.PWD {|config|
let val = ($config | get -i hooks.env_change.PWD)
if $val == $nothing {
if $val == null {
$val | append {|before, after| print $"changing directory from ($before) to ($after)" }
} else {
[
Expand Down
2 changes: 1 addition & 1 deletion book/types_of_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ print $x

## Null

Finally, there is `null` (also known as `$nothing`) which is the language's "nothing" value, similar to JSON's "null". Whenever Nushell would print the `null` value (outside of a string or data structure), it prints nothing instead. Hence, most of Nushell's file system commands (like [`save`](/commands/docs/save.md) or [`cd`](/commands/docs/cd.md)) produce `null`.
Finally, there is `null` which is the language's "nothing" value, similar to JSON's "null". Whenever Nushell would print the `null` value (outside of a string or data structure), it prints nothing instead. Hence, most of Nushell's file system commands (like [`save`](/commands/docs/save.md) or [`cd`](/commands/docs/cd.md)) produce `null`.

You can place `null` at the end of a pipeline to replace the pipeline's output with it, and thus print nothing:

Expand Down
4 changes: 2 additions & 2 deletions lang-guide/lang-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ The second syntax is simply a list of records. This plays on the Nushell data mo

### Nothing

The type or value `$nothing` is to be used to represent the absence of another value. Commands that explicitly do not return a value return `$nothing`
The type `nothing` is to be used to represent the absence of another value. Commands that explicitly do not return a value return `null`.
Use as a missing value indicator.

### Error
Expand Down Expand Up @@ -271,7 +271,7 @@ if false {
}
```

The `else` part of `if` is optional. If not provided, if a condition is false, the `if` expression returns `$nothing`.
The `else` part of `if` is optional. If not provided, if a condition is false, the `if` expression returns `null`.

The code that follows the `else` is an expression rather than a block, allowing any number of follow-on `if` expressions as well as other types of expressions. For example, this expression returns 100: `if false { 1 } else 100`.

Expand Down

0 comments on commit eb262be

Please sign in to comment.