Saturday, 24 August 2013

accessing local variable in nested block in ruby

accessing local variable in nested block in ruby

I have a scenario
func1 do
x='abc'
func2 do
puts x
end
end
for this I get x = nil. Why is it so, and how to access external variable
like x in inner block.

No comments:

Post a Comment