From: Bill Kelly Date: 2009-12-24T16:35:16+09:00 Subject: Re: Storing methods in arrays or hashes Philliam Auriemma wrote: > > newtable = { 1 = function() print("hi from 1") end, > 2 = function() print("hi from 2") end > } # here's an example, similar to the above, but # also passing an argument: newhash = { 1 => lambda {|x| puts("#{x} from 1")}, 2 => lambda {|x| puts("#{x} from 2")} } newhash[1].call("hi") newhash[2]["bye"] # alternate call syntax # produces: hi from 1 bye from 2 Hope this helps, Bill