Skip to content

Commit

Permalink
[Docs] Clarify the behvior of first, last, and nth on empty generators
Browse files Browse the repository at this point in the history
  • Loading branch information
mousetail authored Sep 14, 2024
1 parent 860af44 commit 7896db5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/content/manual/v1.7/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3017,10 +3017,16 @@ sections:
The `nth(n)` function extracts the nth value of any array at `.`.
`first` and `nth` output `empty` if the generator has insufficient
elements. `last` returns `null` instead.
examples:
- program: "[range(.)]|[first, last, nth(5)]"
input: "10"
output: ["[0,9,5]"]
- program: "[range(.)]|[[first], [last], [nth(5)]]"
input: "0"
output: ["[[],[null],[]]"]

- title: "`reduce`"
body: |
Expand Down

0 comments on commit 7896db5

Please sign in to comment.