From: Daniel Finnie Date: 2008-03-21T08:14:51+09:00 Subject: Re: Dealing properly with scope; came from:combine array(string) to string? 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 } Also, I would caution against using the variable i as anything but a loop counter. Regards, Dan On Thu, Mar 20, 2008 at 6:56 PM, Todd Benson wrote: > In much of my code, I've built an Array object before a block for > scope reasons. Is this common practice? > > b = %w|a b c d e| > a = [] #instantiation > b.each {|i| a << i*2} > puts a > > Todd > >