Course of Raku / Essentials / Control flow 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
← Using
unless | Comparing
numbers →
💪 Or jump directly to the exercises in this
section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська