Ruby-on-rails – How to create a ruby Hello world


I know in PHP you have to intrepret a page like index.php, but in Ruby how does it work? I don't know what is the Ruby extension like index.php for PHP. Could you help me?

Best Solution

If you are talking about a command line program this will work.

puts "Hello World"

or if you want an object oriented version

class HelloWorld
   def initialize(name)
      @name = name.capitalize
   def sayHi
      puts "Hello #{@name}!"

hello ="World")

If you are looking for a ruby on rails version of Hello World. Check the Getting Started Guide for Rails.