Skip to content
Closed
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
10 changes: 5 additions & 5 deletions commands/docs/each.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Produce a list of values in the record, converted to string

```

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

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

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

## Subcommands:

Expand Down
Loading