YAP6 Operator: Conditional Operator

by Adriano Ferreira

Another article of the series "Yet Another Perl 6 Operator"

The syntax of an if-then-else expression in Perl 6 is composed by the conditional operator.

say "My answer is: ", $maybe ?? 'yes' !! 'no';

The expression above is equivalent to that, which uses the if-then-else statement within a do.

say "My answer is: ", do {
if $maybe {
else {