Course of Raku / Essentials / Boolean type / Boolean operations

Quiz: Boolean operations

In each of the sections below, select the correct answer that the program prints.


Here is the program:

my $value = True && False;
say $value;

What does it print?

0 True
1 False


What does the second program print?

my $value = True && False || True;
say $value;
1 True
0 False


What is the output of this program?

my $value = True || False && True;
say $value;
1 True
0 False


In the second and third programs, we have expressions with three Boolean values. The result depends on the order in which the operations are executed. The && operator has tighter precedence than ||, so it is executed first.

Course navigation

Boolean type   |   Boolean type / Boolean operations with other types

💪 Or jump directly to the exercises to this section.