On Apr 20, 2007, at 11:39 AM, Mike Steiner wrote:

> Some Python programs have a couple lines of code like this:
>
> if __main__ == "__main__"
>    main()
>
> I think it's supposed to call the main function if the script is  
> executed
> directly. Is there an equivalent in Ruby? Or is it even necessary  
> in Ruby?
>
> (I'm new to Ruby, so excuse me if this is a stupid question.)
>
> Mike Steiner

I'm not entirely sure what that Python code means, but to do  
something if the script is executed directly, you can try:

if __FILE__ == $0
   (do something)
end