I don't get it. Isn't `|i|` the shorthand version of a lambda binding an i? And `lambda { i }` a lambda not binding anything? So why is the result surprising? I must be missing something.
Edit: I mean in
each { |i| p i }
the |i| stands for a shorthand lambda, that binds an i.
And in
for i in 1..3
p i
end
there is no such binding. So where's the problem? That 'for' should use a lambda?
Comments
I don't get it. Isn't `|i|` the shorthand version of a lambda binding an i? And `lambda { i }` a lambda not binding anything? So why is the result surprising? I must be missing something.
Edit: I mean in
the |i| stands for a shorthand lambda, that binds an i.And in
there is no such binding. So where's the problem? That 'for' should use a lambda?