There are some key differences between procs / lambdas and traditional methods in Ruby, however the differences can many times be subtle. In this exercise we’ll examine how variable scope is processed differently between the different options.
Build a program that illustrates the differences in variable scope in Ruby between Procs / Lambdas, and traditional methods.
Build a traditional method and a lambda or Proc and illustrate how the two processes have different access levels for local variables.
This exercise showcases one of the subtle differences between Procs / lambdas and plain Ruby methods. At a high level it may seem like the three options can be used interchangeably, however in this guide we’ll walk through how they approach variable access much differently.
Can be found on the solutions branch on github.