Blocks, Procs, and Lambdas in Ruby
Blocks, Procs, and Lambdas are Ruby’s approach to closures.
Blocks are any anonymous function that can be passed into methods. The’re the sections of code encapsulated between either braces `{}` or `do…end` syntax. In short: you’ve probably used them a lot before. Procs and Lambdas are both blocks that can be assigned to a variable.