From: Frank Meyer Date: 2007-08-17T04:01:43+09:00 Subject: Re: Passing two functions as parameters Gavin Kistner wrote: > On Aug 16, 12:40 pm, Frank Meyer wrote: >> Is it possible to pass a function as a parameter? > > irb(main):001:0> def hi; puts "hello"; end > => nil > irb(main):002:0> def earth; puts "world"; end > => nil > irb(main):003:0> def do2( f1, f2 ) > irb(main):004:1> f1.call > irb(main):005:1> f2.call > irb(main):006:1> end > => nil > irb(main):007:0> do2( method(:hi), method(:earth) ) > hello > world > => nil > > See also lambda and Proc.new for defining anonymous functions on the > fly. Thank you that's exactly what I need. Turing. -- Posted via http://www.ruby-forum.com/.