Turning a block into objects is a super cool part of the Ruby language. There are effectively four ways to go about this: lambda, proc, Proc.new, and method(&block). I will focus away from proc since it is deprecated in future versions of Ruby, and Proc.new is essentially the same as method(&block). 1) lamdba 1 2 3 4 5   thing = lambda { |x| x + " is tasty"} puts thing.call("trout")   => "trout is tasty" 2) Proc.new 1 2 3 4 5   thing = Proc.new { |x| x + " is tasty" } puts thing.call("perch")   => "perch is tasty" Basically they are the same. There two differences to be aware of. The first involves how the methods[…]

This exercise was given to me recently. It represents an elevator. You call the elevator with a param of values, and the elevator comes to you stopping at each floor you’ve told it to. There are actually hundreds of hangups on this problem and hopefully I will gain more time to extend this example more effectively. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35   def elevator( command ) # create a random starting point for the elevator current_level = rand( 100 ) if current_level == command.first # same floor puts "current level[…]