From: dblack@... Date: 2006-08-12T09:11:15+09:00 Subject: Re: Beginner's question: assigning same value to many variables Hi -- On Sat, 12 Aug 2006, Chad Perrin wrote: > On Sat, Aug 12, 2006 at 08:57:37AM +0900, dblack@wobblini.net wrote: >> On Sat, 12 Aug 2006, Mark Van Holstyn wrote: >> >>> or you could do >>> >>> %w{ a b c d e f g h i j }.each {|v| eval "#{v}=''" } >> >> That won't work; they'll go out of scope. Actually out of two scopes: >> the eval scope, and the #each block scope. > > . . . which is great if you're trying to construct a closure, but not so > great otherwise. I don't think it's ever good for variables you want to use to be out of scope :-) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.