In Ruby (v2.5.0)...
[1,2,3].map do |i|
if i.eql?(3)
a = 123
end
defined?(a)
end
=> ["local-variable", "local-variable", "local-variable"]
Can someone please explain to me how a
can be a local-variable
(equal to nil
) in the first and second iteration, if it's not set until the third iteration?
Thanks in advance!