mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 10:09:00 +02:00
fix strip trailing whitespace for make_docs script (#4597)
This commit is contained in:
@ -8,11 +8,12 @@ Run a block on each element of input
|
||||
|
||||
## Signature
|
||||
|
||||
```> each (block) --numbered```
|
||||
```> each (block) --keep-empty --numbered```
|
||||
|
||||
## Parameters
|
||||
|
||||
- `block`: the block to run
|
||||
- `--keep-empty`: keep empty result cells
|
||||
- `--numbered`: iterate with an index
|
||||
|
||||
## Examples
|
||||
@ -21,3 +22,13 @@ Multiplies elements in list
|
||||
```shell
|
||||
> [1 2 3] | each { |it| 2 * $it }
|
||||
```
|
||||
|
||||
Iterate over each element, keeping only values that succeed
|
||||
```shell
|
||||
> [1 2 3] | each { |it| if $it == 2 { echo "found 2!"} }
|
||||
```
|
||||
|
||||
Iterate over each element, keeping all results
|
||||
```shell
|
||||
> [1 2 3] | each --keep-empty { |it| if $it == 2 { echo "found 2!"} }
|
||||
```
|
||||
|
Reference in New Issue
Block a user