Course of Raku / Essentials / Variables and data types essentials / Ranges / Matching against a range

Quiz — Matching against a range

Below are a number of matches against the range. Try to find out the correct answers.

1

True10 ~~ 0..20 is  (: True, False :)
True10 ~~ ^20 is  (: True, False :)
True0 ~~ ^10 is  (: True, False :)
False10 ~~ 10^..15 is  (: True, False :)
True11 ~~ 10..15 is  (: True, False :)
True14 ~~ 10^..15 is  (: True, False :)
False15 ~~ 10^..^15 is  (: True, False :)

2

A bit trickier. What if to match a range against another range?

True2..3 ~~ 1..5 is  (: True, False :)
False1..2 ~~ 5..6 is  (: True, False :)
False1..5 ~~ 3..7 is  (: True, False :)

Course navigation

Matching against a range   |   If the number is within the limits

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська