Course of Raku / Essentials / Conditional checks
if
and unless
as statement modifiers
Raku offers a very handy solution when you want to execute a simple statement conditionally. In this case, there’s no need to create a separate block of code. Just put if
or unless
immediately after the statement. In Raku, such constructs are called statement modifiers.
say 'Good afternoon' if $hours > 12;
say 'All systems work' unless $broken;
Course navigation
←
Conditional checks / Using unless
|
Conditional checks / Comparing numbers
→
💪 Or jump directly to the exercises to this section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська