develooper Front page | perl.perl6.language | Postings from June 2005

Re: return() in pointy blocks

Thread Previous | Thread Next
From:
Luke Palmer
Date:
June 7, 2005 14:09
Subject:
Re: return() in pointy blocks
Message ID:
7ca3f01605060714083ac783fb@mail.gmail.com
On 6/7/05, Luke Palmer <lrpalmer@gmail.com> wrote:
> Then let's put it this way:
> 
>    sub foo () {
>        for 0..10 {
>            when 6 { return 42 }
>        }
>        return 26;
>    }
> 
> And if that didn't do it, then let's write it equivalently as:
> 
>    sub foo () {
>        &map(-> $_ { return 42 }, 0..10);
>        return 26;
>    }

Not that it's that important to the argument, but of course I mean:

     sub foo() { 
         &map(-> $_ { return 42 when 6 }, 0..10);
         return 26;
     }

Luke

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