Ruby Lambda Operator

A lambda is a way to define a block and its parameter with special syntax.

greet1 = -> { puts “Hello world.” }

greet2 = lambda { puts “Hello world !” }

greet1.call

greet2.call

greet_with_param = ->(name) { puts “Hello #{name}!” }

greet_with_param.call(“Joni”)