Course of Raku / Essentials / Variables and data types essentials / Boolean type / Boolean operations
Quiz: Boolean operations
In each of the sections below, select the correct answer that the program prints.
1
Here is the program:
my $value = True && False;
say $value;What does it print?
| 0 | True |
| 1 | False |
2
What does the second program print?
my $value = True && False || True;
say $value;| 1 | True |
| 0 | False |
3
What is the output of this program?
my $value = True || False && True;
say $value;| 1 | True |
| 0 | False |
Comments
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 operations | Boolean operations with other types →
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська