ruby

Lambda in ruby in one line

This example explains a lot

One line, anonymous and flexible

lambda {|x| puts "hey #{x} " }.call "Serge"

 

Results in lambda being (.called ) with parameter. Output would be > hey Serge

Nice , isn’t it :), all in one line.

Share This:

Leave a Reply