Learning how to use closures in Ruby