Hi,
could someone please put a finger on the point i’m missing?
source:
def test *a
p a
end
[[1,2], [3,4]].each &method(:test)
puts “-----”
[[1,2], [3,4]].each &method(:p)
puts “-----”
[[1,2], [3,4]].each {|e| p e}
output:
[1, 2]
[3, 4]
1
2
3
4
[1, 2]
[3, 4]
ruby 1.8.2 (2004-12-25) [i386-mswin32]
Why is the second version interating over each single element?
cheers
Simon