Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 8 additions & 6 deletions docs/content/3.manual/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2044,13 +2044,16 @@ sections:
produces a value other than false or null, but act the same
as `C` otherwise.

`if A then B end` is the same as `if A then B else . end`.
That is, the `else` branch is optional, and if absent is the
same as `.`.

Checking for false or null is a simpler notion of
"truthiness" than is found in Javascript or Python, but it
means that you'll sometimes have to be more explicit about
the condition you want: you can't test whether, e.g. a
the condition you want. You can't test whether, e.g. a
string is empty using `if .name then A else B end`, you'll
need something more like `if (.name | length) > 0 then A else
B end` instead.
need something more like `if .name then A else B end` instead.

If the condition `A` produces multiple results, then `B` is evaluated
once for each result that is not false or null, and `C` is evaluated
Expand All @@ -2059,14 +2062,13 @@ sections:
More cases can be added to an if using `elif A then B` syntax.

examples:
- program: |-
if . == 0 then
- program: 'if . == 0 then
"zero"
elif . == 1 then
"one"
else
"many"
end
end'
input: 2
output: ['"many"']

Expand Down
Loading