From: Todd Benson Date: 2008-03-21T16:14:43+09:00 Subject: Re: Dealing properly with scope; came from:combine array(string) to string? On Thu, Mar 20, 2008 at 6:14 PM, Daniel Finnie wrote: > You can usually use inject or collect to eliminate the a = [] line. > For example: > > > b = %w[a b c d e] > a = b.collect {|i| i * 2 } Unless you have a method that doesn't return an array (i.e. something other than map/collect). Sometimes you have to build the array inside the iterator. I was just wondering if this was common practice. > > Also, I would caution against using the variable i as anything but a > loop counter. For production code, I agree. But, I think even then, I wouldn't use "i". Todd