Course of Raku / Regexes and grammars / Regexes / Matching strings / The smartmatch operator

Quiz — Smartmatch

What does the following program print? Note that there is no so this time, and the match uses the m/.../ form.

say 'the cat sat' ~~ m/sat/;
0True
0False
1「sat」
0Nil

m/sat/ matches the same way /sat/ would. Without so to coerce it to a Boolean, the smartmatch returns the match object itself, which say prints between corner brackets as 「sat」.

Course navigation

The smartmatch operator   |   The match object