From: dblack@... Date: 2003-10-09T10:34:35+09:00 Subject: Re: Enumerable#inject is surprising me... Hi -- On Tue, 7 Oct 2003, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Enumerable#inject is surprising me..." > on 03/10/07, nobu.nokada@softhome.net writes: > > |> ['a'].inject(''){break 'b'} # => 'b' > | > |But this doesn't work as Nathaniel expected. It returns last > |iteration value, "". > > Commit the fix, please. Using the new version: $ ./ruby -v ruby 1.8.0 (2003-10-06) [i686-linux] $ ./ruby -e 'p ["a"].inject("start") {|x,y| "b"}' "b" $ ./ruby -e 'p ["a"].inject("start") {|x,y| break "b"}' "start" I'm still not understanding why these should be different, or how "start" gets into the first one (the first block) at all. David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav