From: yermej Date: 2008-01-10T08:55:00+09:00 Subject: Re: problem with closure/block On Jan 9, 3:42 pm, "levili...@gmail.com" wrote: > ########################### > y=5 > print "y: " + y.to_s + "\n" > text_at_the_end = lambda do |y| >   print y + " text at the end\n" > end > > print "y: " + y.to_s + "\n" > > def oneparam >   yield("oneparam") > end > > oneparam(&text_at_the_end) > print "y: " + y + "\n" > > ######################## > It gives the following output: > > y: 5 > y: 5 > oneparam text at the end > y: oneparam > > Is this a bug? Shouldn't "y" be in a local scope in "text_at_the_end"? > I just downloadad Ruby yesterday: > >     Ruby Version 1.8.6 >     Installer Version 186-26 There are past threads that discuss this, but, basically, no, it's not a bug, that's just how Ruby does it.