Short-circuiting Boolean "and" and "or" operators.

This commit is contained in:
Stephen Dolan committed 2012-09-04 20:38:59 +01:00
1 parent c5ab3b2336
commit 6e6ea50763
5 files changed
+62 -5

No files matched your search

+6
View File
@@ -254,3 +254,9 @@ def inc(x): x |= .+1; inc(.[].a)
[{"foo":[1,2], "bar": 42}, {"foo":[1], "bar": null}, {"foo":[null,false,3], "bar": 18}, {"foo":[], "bar":42}, {"foo": [null,false,null], "bar": 41}]
[[1,2], [1], [3], [42], [41]]
.[] | [.[0] and .[1], .[0] or .[1]]
[[true,[]], [false,1], [42,null], [null,false]]
[true,true]
[false,true]
[false,true]
[false,false]