[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Enumerable#inject is surprising me...

Nathaniel Talbott

10/6/2003 11:29:00 PM

Does it surprise you?

irb(main):001:0> ['a'].inject{break 'b'}
=> "a"

I expected "b" as the result. Is this intendend behavior? If so, what is the
rationale behind it, and how do I force #inject to immediately return a
given value?

Thanks,


Nathaniel

<:((><