When I run these two Ruby scripts I got two different answers. Also, if
I run the first script on irb, I get the same result as the second
script (and I know the results on second script and irb are correct). Am
I missing something on the first script? Thanks.
first example behaves like puts(h1.merge(h2)) do ... end
second example behaves like puts(h1.merge(h2) {...})
It has nothing to do with the block itself, this works fine:
merged = h1.merge(h2) do |...|
...
end
puts merged
···
Am 28.09.2012 22:18, schrieb Carlos da Silva:
When I run these two Ruby scripts I got two different answers. Also, if
I run the first script on irb, I get the same result as the second
script (and I know the results on second script and irb are correct). Am
I missing something on the first script? Thanks.