From: James Edward Gray II Date: 2006-02-13T06:38:09+09:00 Subject: Re: How to pass a function as argument in ruby? On Feb 12, 2006, at 3:23 PM, the_crazy88 wrote: > But the equivalent ruby code doesn't work: > > def a(x,y) > return x+y > end > > def x(b) > return b(3,4) > end > > x(a) > #Gives the following error in irb: You can ask for a method object and call it when needed: def a(x,y) return x+y end def x(b) return b.call(3,4) end p x(method(:a)) Hope that helps. James Edward Gray II