The Ruby Lambda


#1




I don't understand why write a_lambda.call in here? a_lambda is a parameter, why we can use .call on a parameter? (I do understand .call from previous exercises.)


def lambda_demo(a_lambda)
  puts "I'm the method!"
  a_lambda.call
end

lambda_demo(lambda { puts "I'm the lambda!" })


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.