From: Patrick Gundlach Date: 2005-12-07T20:12:34+09:00 Subject: Re: Variable score Hi, as others have pointed out, create a reference to var1,var2 before the block: # same as your example: %w( foo bar ).each do |w| if w.match(/foo/) a="something" end if w.match(/bar/) puts a #=> nil end end # -------------------------------------------------- # this one is OK a=nil %w( foo bar ).each do |w| if w.match(/foo/) a="something" end if w.match(/bar/) puts a # => something end end # -------------------------------------------------- But this is still dangerous, it might lead to hard to find bugs. Patrick