Update some examples and docs (#4682)

* Update some examples and docs

* Update now.rs

* Update date_now.md

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
This commit is contained in:
Justin Ma
2022-03-01 21:05:29 +08:00
committed by GitHub
parent 2a89936bee
commit 42f1874a3a
11 changed files with 80 additions and 16 deletions

View File

@ -28,6 +28,11 @@ Iterate over each element, keeping only values that succeed
> [1 2 3] | each { |it| if $it == 2 { echo "found 2!"} }
```
Iterate over each element, print the matching value and it's index
```shell
> [1 2 3] | each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }
```
Iterate over each element, keeping all results
```shell
> [1 2 3] | each --keep-empty { |it| if $it == 2 { echo "found 2!"} }