Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Borrow parts of the description of ^^ from the synopsis to describe h…
…ow it really behaves when all the arguments are false.
  • Loading branch information
pmurias committed Dec 6, 2016
1 parent e01fd79 commit 9de42a4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions doc/Language/operators.pod6
Expand Up @@ -1723,11 +1723,16 @@ true value, the arguments to the right of are never evaluated.
=head2 infix C«^^»
Returns the first true argument if there is only one, and L<Nil> otherwise.
Short-circuits as soon as two true arguments are found.
X<Short-circuit exclusive-or>. Returns the true argument if there
is one (and only one). Returns the last argument if all arguments are false.
Returns C<Nil> otherwise (when more than one argument is true).
This operator short-circuits in the sense that it does not evaluate
any arguments after a 2nd true result.
say 0 ^^ 42; # 42
say 0 ^^ 42 ^^ 1 ^^ die 8; # (empty line)
say '' ^^ 0; # 0
say 0 ^^ 42 ^^ 1 ^^ die "never called"; # (empty line)
Note that the semantics of this operator may not be what you assume: infix C«^^»
flips to first true value it finds, and then flips to Nil I<forever> after the
Expand Down

0 comments on commit 9de42a4

Please sign in to comment.