From: ts Date: 2002-04-01T01:19:17+09:00 Subject: Re: scoping question >>>>> "Y" == Yohanes Santoso writes: Y> anArray.each do |x| Y> anArray[0].diff(x).each do |x| [...] Y> end Y> puts "current_item => #{x}" Y> end Y> What's going on? Shouldn't variables declared within the do..end Y> and/or {..} block, are visible only from within the block? Yes, The problem is that |x| don't declare a variable, but it must be seens as a multi-assignement With this example 1.times do x = 12 1.times do x = 24 end end The first assignement `x = 12' create a dynamic variable (because this is the first time that ruby see this variable) The second assignement `x = 24' just affect a new value to the previous declared variable `x' This is the same for your example. Guy Decoux