From: Nicolas Williams Date: Mon, 7 Jul 2014 22:22:53 +0000 (-0500) Subject: Explain `foreach`'s powers a bit more X-Git-Tag: jq-1.5rc1~138 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6458910ba3088ba653e368f20505e8e78657257b;p=jq Explain `foreach`'s powers a bit more --- diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml index 4704254..12fcffb 100644 --- a/docs/content/3.manual/manual.yml +++ b/docs/content/3.manual/manual.yml @@ -1842,7 +1842,10 @@ sections: for each new state to extract an output of `foreach`. This is mostly useful only for constructing `reduce`- and - `limit`-like functions. + `limit`-like functions. But it is much more general, as it + allows for partial reductions (see the example below), as well + as breaking out of the "loop" with `empty`, or even `error(x)` + if there's a try/catch around the foreach. examples: - program: '[foreach .[] as $item