Course of Raku / Essentials / Conditional checks
else
blocks
An if
block can be followed by an else
block, which is run when the condition is not satisfied.
my $t = 36.6;
if 35.5 < $t < 37.5 {
say 'You are fine.';
}
else {
say 'Call a doctor, maybe?';
}
The else
block cannot be used on its own (there is a better alternative called unless
, which will be introduced just in a minute).
Course navigation
←
Conditional checks / if
blocks
|
Conditional checks / Using elsif
→
💪 Or jump directly to the exercises to this section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська