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,
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.
3) Run the following command.
ruby hello.rb
Leave a Reply