Robert Klemme
10/20/2003 11:26:00 AM
"Yukihiro Matsumoto" <matz@ruby-lang.org> schrieb im Newsbeitrag
news:1066641883.530342.13684.nullmailer@picachu.netlab.jp...
> Hi,
>
> In message "Re: Enumerable#inject is surprising me..."
> on 03/10/07, dblack@superlink.net <dblack@superlink.net> writes:
>
> |> > ['a'].inject(''){break 'b'} # => 'b'
> |>
> |> But this doesn't work as Nathaniel expected. It returns last
> |> iteration value, "".
> |
> |I'm not sure why it would be "". Wouldn't that only happen if the
> |empty string (the inject accumulator) appeared as the last value in
> |the block?
>
> It's a bug. I fixed it in the latest CVS.
>
> matz.
Sorry if I'm beeing stupid, but I still don't understand why
['a'].inject(''){break 'b'} should not return 'b'. Could you please
clarify this to me? Thank you.
Kind regards
robert