From: Bala TS Date: 2011-05-26T21:46:04+09:00 Subject: Re: "Local variable within code blocks do not interfere with those outside the block" I got the point if you try like this way Here x is a variable(array_variable) it contains 5 elements x = [1,2,3,4,5] x.each do |r| puts "#{r}" end => the result like this order 1 2 3 4 5 This code print x.length time print var= 10 x.each do |r| var = 10 puts "#{var}" end => the result like this order 10 10 10 10 10 But you gave x.each do |r| var = 10 end puts "#{var}" x=[1,2,3,4,5] x.each do |r| @var = 10 end puts "#{@var}" => then the x.lenth'th last var value is printed here, the the reason u got ten value 10 -- Posted via http://www.ruby-forum.com/.