Hello World Program in Ruby



In this tutorial, we will learn how to write a Hello World program in Ruby language, and print Hello World to standard output.

The Ruby program that prints Hello World message to standard output is:

Ruby Program

puts "Hello, World!"
Try with Ruby Compiler ➚

Output

Hello, World!

Click on Try with Ruby Compiler ➚ button after the Ruby program to open Online Ruby Compiler, and run the program.

Or, you may also click on the below the Ruby program to copy the code to clipboard and then paste the code in an editor of your choice.


Working of the "Hello, World!" Program

  1. puts "Hello, World!"
    This line prints the string "Hello, World!" to the console. The puts method prints the given object, with a trailing new line.