File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1723,11 +1723,16 @@ true value, the arguments to the right of are never evaluated.
1723
1723
1724
1724
= head2 infix C « ^^ »
1725
1725
1726
- Returns the first true argument if there is only one, and L < Nil > otherwise.
1727
- Short-circuits as soon as two true arguments are found.
1726
+ X < Short-circuit exclusive-or > . Returns the true argument if there
1727
+ is one (and only one). Returns the last argument if all arguments are false.
1728
+ Returns C < Nil > otherwise (when more than one argument is true).
1729
+
1730
+ This operator short-circuits in the sense that it does not evaluate
1731
+ any arguments after a 2nd true result.
1728
1732
1729
1733
say 0 ^^ 42; # 42
1730
- say 0 ^^ 42 ^^ 1 ^^ die 8; # (empty line)
1734
+ say '' ^^ 0; # 0
1735
+ say 0 ^^ 42 ^^ 1 ^^ die "never called"; # (empty line)
1731
1736
1732
1737
Note that the semantics of this operator may not be what you assume: infix C « ^^ »
1733
1738
flips to first true value it finds, and then flips to Nil I < forever > after the
You can’t perform that action at this time.
0 commit comments