From: Dave Thomas Date: 2000-11-21T05:48:34+09:00 Subject: [ruby-talk:6472] Re: Function declarations? "Makhno" writes: > I was wondering if it possible to obtain a reference to a function before it > has been > 'def'ined? Sort of... The reference to a function is by name, not by function pointer, so you can use the name before the function exists: fn = case ARGV[0] when "clear" :doClear when "reset" :doReset else :doError end However the function must be defined before you can call it: # self.method(fn).call # this would be an error def doClear puts "Clear" end def doReset puts "Reset" end def doError puts "Error" end self.method(fn).call # This is OK Regards Dave