This example assumes Ruby is installed.
Place the following in a file named
puts 'Hello World'
From the command line, type the following command to execute the Ruby code from the source file:
$ ruby hello.rb
This should output:
The output will be immediately displayed to the console. Ruby source files don't need to be compiled before being executed. The Ruby interpreter compiles and executes the Ruby file at runtime.