From: Joao Pedrosa Date: 2005-02-12T02:35:31+09:00 Subject: Re: new to this language Hi, > > 3) Do you need a main and a makefile ? I am sure you would need a main > > to test it . If yes how do you save the main? In what format? > > You don't need a main method. All Ruby code is executed as it is seen by the > interpreter. Some of the code above (superclass.rb and myclass.rb) define > classes and some of the code (another.rb) creates an instance of a class and > prints some output. Else, you can use if __FILE__ == $0 p 'Hello World!' end In any file so the code in the if-block will be executed only if the file is being run directly by the interpreter (e.g.: ruby hello_world.rb). It's useful so you can have a file that behaves like a library and a program, depending on how it's loaded. You load a library with the require (or load) command (e.g.: require 'open-uri'). I like to use such capability to test one or another thing in a file while I'm working on it. Welcome to Ruby. Cheers, Joao