Skip to content

Commit e60d9e7

Browse files
committed
Make it clearer about each behavior toward null
1 parent 932a14b commit e60d9e7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

commands/docs/each.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Produce a list of values in the record, converted to string
6060
6161
```
6262

63-
Produce a list that has "two" for each 2 in the input
63+
`null` items will be dropped from the result list. It has the same effect as `filter_map` in other languages.
6464
```nu
6565
> [1 2 3 2] | each {|e| if $e == 2 { "two" } }
6666
╭───┬─────╮
@@ -91,13 +91,13 @@ Iterate over each element, keeping null results
9191
```
9292

9393
## Notes
94-
Since tables are lists of records, passing a table into 'each' will
94+
Since tables are lists of records, passing a table into `each` will
9595
iterate over each record, not necessarily each cell within it.
9696

9797
Avoid passing single records to this command. Since a record is a
98-
one-row structure, 'each' will only run once, behaving similar to 'do'.
99-
To iterate over a record's values, try converting it to a table
100-
with 'transpose' first.
98+
one-row structure, `each` will only run once, behaving similar to [`do`](/commands/docs/do.md).
99+
To iterate over a record's values, use [`items`](/commands/docs/items.md) or try converting it to a table
100+
with [`transpose`](/commands/docs/transpose.md) first.
101101

102102
## Subcommands:
103103

0 commit comments

Comments
 (0)