I’m using ruby 1.8.7. I could have sworn that I’ve written my functions at the bottom of my script before and it worked fine.
Do I have to put them at the top? It seems to be the only way they work now. Not a big deal. I just prefer to have them at the bottom so I figured I’d ask.
You can do initializing code in one or more BEGIN-blocks (inherited from Perl, which inherited them from awk).
And for completeness, there are also END-blocks: