I am reading along in pickaxe 1.9 and the author uses lambda like this:
bo = lambda {|param| puts "You called me with #{param}"}
bo.call 99 => 'You called me with 99'
bo.call "cat" => 'You called me with cat'
My question is this: How is this any better/worse/different than just defining a method that does that same thing? Like so:
def bo(param)
puts "You called me with #{param}"
end
bo("hello") => 'You called me with hello'
To me the lambda syntax seems much more confusing and spaghetti-like.