[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Enumerable#inject is surprising me...

Nathaniel Talbott

10/9/2003 1:55:00 PM

dblack@superlink.net [mailto:dblack@superlink.net] wrote:

> > #inject ignore the value returned by break, and return the last
> > result.
>
> I thought "break val" executed a break *and* generated a
> return value for the block at the same time:
>
> irb(main):011:0> a = proc { break 3 } .call; a
> => 3
>
> Why wouldn't #inject treat the break the same way?

I thought that was what was broken, but I believe I'm officially confused,
too :-)


Nathaniel

<:((><


2 Answers

Robert Klemme

10/9/2003 2:32:00 PM

0


"Nathaniel Talbott" <nathaniel@NOSPAMtalbott.ws> schrieb im Newsbeitrag
news:019801c38e6c$e6ea41f0$c81e140a@abraham...
> dblack@superlink.net [mailto:dblack@superlink.net] wrote:
>
> > > #inject ignore the value returned by break, and return the last
> > > result.
> >
> > I thought "break val" executed a break *and* generated a
> > return value for the block at the same time:
> >
> > irb(main):011:0> a = proc { break 3 } .call; a
> > => 3
> >
> > Why wouldn't #inject treat the break the same way?
>
> I thought that was what was broken, but I believe I'm officially
confused,
> too :-)

Welcome to the club. Me too. Does anybody out there (Matz, Nobu) dare to
summarize problem and proposed solution? Thanks!

robert

matz

10/9/2003 3:29:00 PM

0

Hi,

In message "Re: Enumerable#inject is surprising me..."
on 03/10/09, "Robert Klemme" <bob.news@gmx.net> writes:

|Welcome to the club. Me too. Does anybody out there (Matz, Nobu) dare to
|summarize problem and proposed solution? Thanks!

Wait for a few days. I am working on it.

matz.