Key Concepts

Review core concepts you need to learn to master this subject

Ruby .call Method

proc_test = { puts "I am the proc method!" } lambda_test = lambda { puts "I am the lambda method!"} # => I am the proc method! # => I am the lambda method! #The following code would result in "I am the proc method!" and "I am the lambda method!" printed to the console respectively, once the proc, proc_test, and the lambda, lambda_test, are called.

In Ruby, a proc and a lambda can be called directly using the .call method.

Blocks, Procs, and Lambdas
Lesson 1 of 1