Course of Raku / Essentials / Variables and data types essentials / Ranges
Matching against a range
Take a range and a variable with an integer value in it:
my $r = 1..10;
my $v = 7;Using the smart-match operator ~~, you can
check if the value is within the range:
say $v ~~ $r;In the shown example, the condition is True, so the
program prints True.
Practice
Complete the quiz that covers the contents of this topic.
Course navigation
← Quiz — Creating ranges | Quiz — Matching against a range →
💪 Or jump directly to the exercise to
this section.
Translations of this page: English • Deutsch • Español • Italiano • Latviešu • Nederlands • Български • Русский • Українська