πŸ“˜ Shortcut operator ^^ in Perl 6

πŸ“˜ Shortcut operator ^^ in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.


^^ returns an operand that is True in a Boolean context and that is, at the same time, the only one in the given list. If nothing is found, Nil is returned. As soon as the operator sees the second True value, it stops evaluating the rest, because the result is already known.

say 0 ^^ '' ^^ "abc" ^^ -0.0;Β  # abc
say 0 ^^ '' ^^ "abc" ^^ -10.0; # Nil

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code