Course of Raku / 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

True 10 ~~ 0..20 is  (: True, False :)
True 10 ~~ ^20 is  (: True, False :)
True 0 ~~ ^10 is  (: True, False :)
False 10 ~~ 10^..15 is  (: True, False :)
True 11 ~~ 10..15 is  (: True, False :)
True 14 ~~ 10^..15 is  (: True, False :)
False 15 ~~ 10^..^15 is  (: True, False :)

2

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

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

Course navigation

Ranges / Excluding endpoints   |   💪 Exercise: If the number is within the limits