From: Charles Caldwell Date: 2013-02-16T00:52:21+09:00 Subject: Re: What are lambda functions used for? I find them useful when I'm writing scripts that automate tasks. I'll have many variables and I'll have something I want to do to them over and over with only a slight change. I could write a method but then I'll have to pass in all the variables which will make for a pretty nasty looking parameter list. So, instead, I'll just use a lambda. roll_over_rows = lambda { |column| 7.upto(121) do |row| # Do some stuff with the data in those rows # Insert that data into a new place # Do some calculations end # Update variables with data # Put calculation into another place excel_file.ws.range("#{column}127").value = some_variable + another_variable } roll_over_rows['T'] roll_over_rows['C'] # Called several more times I'm probably breaking some serious design patterns but it is what I personally find lambdas useful for. -- Posted via http://www.ruby-forum.com/.