Just Another Victim of the Ambient Morality
7/6/2006 9:25:00 PM
"Robert Klemme" <shortcutter@googlemail.com> wrote in message
news:4h3v7nF1q0k17U3@individual.net...
>
> Sometimes also #inject will help but that depends on what you do in the
> block. For example:
>
> irb(main):001:0> %w{aa bb cc dd}.inject {|a, b| a + ", " + b}
> => "aa, bb, cc, dd"
>
> Other than that I'd probably stick with the solution that uses
> #each_with_index because it at least avoids creating a new array.
inject skips over the first element! This is exactly what I'm looking
for!
Thank you...