In many ways, a block is like an anonymous function: It can take arguments, it can return a value, and a symbol can be used to call a block. But blocks are much more than this. Using them is a way to pass inline “functions” as method arguments. And most powerfully of all, blocks have access to all the variables that are in scope at the time they are defined. Or put another way, a block is a closure that has access to any variable the creating method can access at the point when the block is defined.
Before you can use blocks, you need to know how to declare, use, and write them.