Clarify description of as
It's more of a foreach loop than an identity operation. Addresses issue #72.
This commit is contained in:
1 parent
925ec3751f
commit
115552f3a6
1 file changed
+4
-3
@@ -953,9 +953,10 @@ sections:
|
|||||||
|
|
||||||
.realnames as $names | .posts[] | {title, author: $names[.author]}
|
.realnames as $names | .posts[] | {title, author: $names[.author]}
|
||||||
|
|
||||||
The expression "foo as $x" runs foo, puts the result in $x,
|
The expression `exp as $x | ...` means: for each value of expression
|
||||||
and returns the original input. Apart from the side-effect
|
`exp`, run the rest of the pipeline with the entire original input, and
|
||||||
of binding the variable, it has the same effect as ".".
|
with `$x` set to that value. Thus `as` functions as something of a
|
||||||
|
foreach loop.
|
||||||
|
|
||||||
Variables are scoped over the rest of the expression that defines
|
Variables are scoped over the rest of the expression that defines
|
||||||
them, so
|
them, so
|
||||||
|
|||||||
Reference in new issue
Block a user