From: Dave Bass Date: 2008-05-30T06:20:05+09:00 Subject: Re: Constants in modules Luis Crespo wrote: > ...But I did not realize that the constant code is executed when reading > the module, so I had to define the method before. Yes, this is a common gotcha. Personally I like to have the main program at the top of my code, but Ruby wants me to put it at the bottom, so it's seen all the function definitions before I try to call them. You can get around it like this: def main # ... end def function1 # ... end def function2 # ... end main Defining a "main" function comes naturally to C programmers, but in Ruby you actually have to call it at the bottom. ;-) -- Posted via http://www.ruby-forum.com/.