# infix ^^

1 | language documentation Operators |

1.1 | (Operators) infix ^^ |

Documentation for infix `^^`

assembled from the following types:

# language documentation Operators

From Operators

## (Operators) infix ^^

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 `Nil`

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; # OUTPUT: «42»say '' ^^ 0; # OUTPUT: «0»say 0 ^^ 42 ^^ 1 ^^ die "never called"; # OUTPUT: «Nil»

Note that the semantics of this operator may not be what you assume: infix `^^`

flips to the first true value it finds and then flips to Nil *forever* after the second, no matter how many more true values there are. (In other words, it has "find the one true value" semantics, not "boolean parity" semantics.)