Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: