2.10. Boolean expressions (logical operators)

Table 2-2. Logical operators

and&&
or||
err//
xor^^
not!
if COND and COND {
}

if COND or COND {
}

if not COND {
}

Example 2-11. examples/scalars/logical_operators.p6

#!/usr/bin/perl6

say (2 and 1);  # 1
say (1 and 2);  # 2
say (1 and 0);  # 0
say (0 and 1);  # 0
say (0 and 0);  # 0
say "---";

say (1 or 0);   # 1
say (1 or 2);   # 1
say (0 or 1);   # 1
say (0 or 0);   # 0
say "---";

say (1 err 0);     # 1
say (0 err 1);     # 0
say (0 err 0);     # 0
say (undef err 0); # 0
say (undef err 1); # 1
say "---";

say (1 xor 0);     # 1
say (0 xor 1);     # 1
say (0 xor 0);     # 
say (1 xor 1);     # 
say "---";

say (not 1);       #
say (not 0);       # 1
say (not undef);   # 1
say "---";