Code-blocks in Ruby are pieces of multiline code written in curly brackets or within a
do..end block that can be passed around to methods such as parameters.
While discussing arrays, we saw the following:
arr.each do |e| puts e end
Here, lets see what the preceding code will do:
do |e| puts e end
This is a code-block which is passed as a parameter to the
Apart from passing code, code-blocks can be used to implement iterators and callbacks.