From: Nathaniel Talbott Date: 2003-10-07T10:11:21+09:00 Subject: Re: Enumerable#inject is surprising me... nobu.nokada@softhome.net [mailto:nobu.nokada@softhome.net] wrote: > > Inject works on pairs of elements. Since your list has only one > > element, there are no pairs. > > It's correct, the code has no iteration. Ah, good point. Missed that. > > You can force one pair in the above example by explicitly > supplying an > > initial element ... > > > > ['a'].inject(''){break 'b'} # => 'b' > > But this doesn't work as Nathaniel expected. It returns last > iteration value, "". Well, at least I was partly right about it not working :-). Thanks, Jim & Nobu. Nathaniel <:((><