From: Michael Morin Date: 2008-08-30T23:20:16+09:00 Subject: Re: Show elements of array separated Robert Klemme wrote: > irb(main):010:0> foo.inject {|a,b| "#{a}, #{b}"} > => "a, b, c" > irb(main):011:0> ["a"].inject {|a,b| "#{a}, #{b}"} > => "a" > irb(main):012:0> [].inject {|a,b| "#{a}, #{b}"} > => nil > irb(main):013:0> > > But note the empty Array case. > > Kind regards > > robert irb(main):006:0> [].inject{|a,b| "#{a}, #{b}" } or "" => "" -- Michael Morin Guide to Ruby http://ruby.about.com/ Become an About.com Guide: beaguide.about.com About.com is part of the New York Times Company