From: 7stud -- Date: 2009-09-18T03:17:12+09:00 Subject: Re: Mucking about with dynamically adding methods to objects 7stud -- wrote: > However, blocks can see variables in the surrounding scope, for example: > > def meth > x = 10 > arr = [1, 2, 3] > > arr.each{|num| puts num + x} > end > > --output:-- > 11 > 12 > 13 > I guess a more pertinent example would be: def meth(val) arr = [1, 2, 3] arr.each{|num| puts num + val} end meth(10) --output:-- 11 12 13 -- Posted via http://www.ruby-forum.com/.