From: Lloyd Zusman Date: 2004-07-31T00:11:50+09:00 Subject: Re: Forward references? Michael Neumann writes: > Lloyd Zusman wrote: >> Is there a way to define forward references to functions? Due to my own >> personal eccentricities, I like to have the main body of a program >> appear at the top of its source file, and the functions it uses at the >> end. >> >> [ ... ] > > Wrap this code into a END block: > > END { > x = foo > y = bar > ... > } Aha! And this got me to think of a similar way to do it that is even more C-like: def main puts foo puts bar exit(0) # or it could be this: return (0) end def foo return "foo" end def bar return "bar" end END { exit(main) } # ... or without the END block as long as the last line of # the file is exit(main) Thank you very much! > Regards, > > Michael -- Lloyd Zusman ljz@asfast.com God bless you.