Hello Ruby Program

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Hello Ruby Program

Now we will write a simple program of Ruby. Before writing Hello World program, we are assuming that you have successfully installed Ruby in your system.


Requirement for Hello Ruby Program

  • Download Ruby and install it.
  • Create a file with .rb extension.
  • Connect Ruby path to the file.
  • Run the file.

Creating Hello Ruby Program

1) Use any text editor and create a hello.rb file. Write the following code,

  1. puts "Hello Ruby !"  

2) Connect Ruby path to the above file. We have created hello.rb file in the Desktop. So first we need to go the Desktop directory through our console.

Ruby Hello ruby program 1

3) Run the following command.

  1. ruby hello.rb  

Ruby Hello ruby program 2

This is final output of our Hello Ruby program