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

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

Thread Previous | Thread Next
From:
William Michels via perl6-users
Date:
June 2, 2021 10:57
Subject:
Re: What's going on with "given (junction) {when (value)...}"
Message ID:
CAA99HCxUXxnX46OBNTfJmX++zV4-yHHWC_4SmDbxfY_8adzpDg@mail.gmail.com
Hi Ralph, Both prefix/postfix 'when' look okay on my Rakudo_2020.10 install:

user@mbook:~$ raku
Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10.
Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
Built on MoarVM version 2020.10.

To exit type 'exit' or '^D'
> when 3 { say 'prefix when' }
False
> { say 'postfix when' } when 3
()
> $_ := any(4,3);
any(4, 3)
> when 3 { say 'prefix when' }
prefix when
> { say 'postfix when' } when 3
postfix when

> $_ := any(5,4);
any(5, 4)
> when 5 { say 'prefix when' }
prefix when
> { say 'postfix when' } when 5
postfix when

> $*VM
moar (2020.10)
>



HTH, Bill.



On Tue, Jun 1, 2021 at 8:09 AM Ralph Mellor <ralphdjmellor@gmail.com> wrote:
>
> Curiously, it works for postfix `when`:
> ```
> $_ := any(4,3);
> {say 'postfix when'} when 3; # 3
> when 3 { say 'prefix when' }  # (no output)
> ```
>
> --
> love, raiph

Thread Previous | 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