Agent Zhang wrote:

> According to S04, given {} is at statement level, so you can't use it
> directly as an expression. But Perl 6 always allow you to say
>  my $foo = do given {...}
> As well as
>  my $foo = do if foo {...} else {...}

I confirmed this both work now with pugs!

I think the 'do given' case is useful enough to document
more officially along with 'given'.

If you are thinking about the if/else case,  ?? ... !! would be a
simpler way to write it.


Reply via email to