Conditional structures
Last updated
Was this helpful?
Last updated
Was this helpful?
Switch structures are done by topicalization and by smartmatching in Raku. They are somewhat orthogonal, you can use a given
block without when
, and vice versa. But the typical use is:
when
blocks are allowed in any block that topicalizes $_
, including a for
loop (assuming one of its loop variables is bound to $_
) or the body of a method (if you have declared the invocant as $_
)." See more at:
There are also statement modifier forms of all of the above.
The looks like this:
and
, or
, &&
, ||
and //
work as in Perl 5.