Course of Raku / Essentials / Variables and data types essentials / Boolean type
Boolean operations
You can do all standard operations with Boolean values: Boolean AND, OR, and exclusive OR (or XOR):
say False && True; # AND
say False || True; # OR
say False ^^ True; # XORThis program prints the following results:
False
True
True
Negation
To negate a Boolean value, use the prefix operator
!:
say !False; # TrueBoolean values can be stored in scalar variables:
my $did = True;
my $didn't = !$did;Practice
Complete the quiz that covers the contents of this topic.
Course navigation
← Boolean type | Quiz: Boolean operations →
💪 Or jump directly to the exercises in this
section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська