develooper Front page | perl.perl6.users | Postings from May 2021

What's going on with "given (junction) {when (value)...}"

Thread Next
From:
yary
Date:
May 31, 2021 02:18
Subject:
What's going on with "given (junction) {when (value)...}"
Message ID:
CAG2CFAZfZzBX8xJJUueJ7M8Y8_L-F9S+qv5MTiOVG+voeJbvkQ@mail.gmail.com
This came up in today's Raku study group (my own golfing-)

> ? (any(4,3) ~~ 3)
True
> ? (3 ~~ any(4,3))
True
> given any(4,3) { when 3 {say '3'}; say 'nope'}
nope
> given 3 { when any(4,3) {say '3'}; say 'nope'}
3
> given any(4,3) { say .raku }
any(4, 3)

why does Raku say 'nope' for the example *"**given any(4,3) { when 3 {say
'3'}; say 'nope'}*"

Since this expression is true *? (any(4,3) ~~ 3)*
I expected the "*given 4|3*" to also match "*when 3*"

-y

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About