Closures in Ruby: Lambdas & Procs

Introduction

Ruby handles Closures in a rather unique way, with Lambdas & Procs being two of the most powerful features.

A Closure basically has the following properties:

● Can be passed around like an object
● Remembers values of all the variables that were in scope.
● Accesses the variables when called, even if they may no longer be in scope.

In Ruby, Closures are supported through Procs and Lambdas. Read more…

Like what you read? Give Ankeet P a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.