From: Mark Bilk Date: 2009-04-10T02:44:53+09:00 Subject: Calling a Function Before It's Defined I would like to be able to call a function (or a class, when I get more object-oriented) earlier in the program file than where I define it. Such a "top-down" layout seems natural to me. In C I could use a function prototype for this. If I try it in Ruby, I get an error (see code below). Even if I do define everything before I use it, how could I write a recursive function, or two mutually recursive functions? s = "abc" # gives error: undefined method `f' for main:Object (NoMethodError) f(s) def f(x) print('f: ', x, "\n") end # works OK f(s) -- Posted via http://www.ruby-forum.com/.