summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2015-03-23 14:57:35 -0500
committerNicolas Williams <nico@cryptonector.com>2015-03-24 01:21:17 -0500
commitffa2832e3345c7a405dfaabf1deb923c07d2627c (patch)
treef028d227fda2b1493ec5258d3ff9a928e6f661e1 /docs
parent0f7759f83106098312224e9cabc5464b8e19a3d0 (diff)
Drop name-less label/break for now
See #734 and #658.
Diffstat (limited to 'docs')
-rw-r--r--docs/content/3.manual/manual.yml35
1 files changed, 10 insertions, 25 deletions
diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml
index 8312d516..1041f2ca 100644
--- a/docs/content/3.manual/manual.yml
+++ b/docs/content/3.manual/manual.yml
@@ -1820,41 +1820,26 @@ sections:
# But if the error caught is not "break" then re-raise it.
try repeat(exp) catch .=="break" then empty else error;
- jq has a syntax for lexical labels to "break" or "go (back) to":
+ jq has a syntax for named lexical labels to "break" or "go (back) to":
- label | ... break ...
+ label $out | ... break $out ...
- The `break` builtin will cause the program to return to act as
- though the nearest `label` (to the left) produced `empty`.
+ The `break $label_name` expression will cause the program to
+ to act as though the nearest (to the left) `label $label_name`
+ produced `empty`.
- The `break2` builtin will return the program to the second
- nearest `label`, then `empty`.
-
- The `break3` builtin will return the program to the third
- nearest `label`, then `empty`.
-
- A variation on this is named labels:
-
- label $name | ... break $name
-
- The `break $name` form returns to the named label and produces
- `empty`.
-
- In all cases the relationship between the `break` and
- corresponding `label` is lexical: the label has to be
- "visible" from the break.
+ The relationship between the `break` and corresponding `label`
+ is lexical: the label has to be "visible" from the break.
To break out of a `reduce`, for example:
- label | reduce .[] as $item (null; if .==false then break else ... end)
+ label $out | reduce .[] as $item (null; if .==false then break $out else ... end)
The following jq program produces a syntax error:
- break
-
- because:
+ break $out
- jq: error: break used outside labeled control structure
+ because no label `$out` is visible.
- title: "`?` operator"
body: |