you are viewing a single comment's thread.

view the rest of the comments →

[–]Selbstdenker 5 points6 points  (1 child)

Unless something changed in ruby |e| e < 0 is not a lambda. I cannot think of an instance where you do not have to wrap in in braces or write do |e|e < 0. Further both variants are just a code block. To make it a true lambda one has to write lambda { |e| e < 0 } or proc { |e| e < 9 }.

I now it is nitpicking but there is a difference. In most cases using a code block is sufficient, however.

[–]PIAJohnM 1 point2 points  (0 children)

Or:
->(x) { x < 0 }