Create and Run the Hello World Program in Ruby
Ruby programs can be written in a very easy manner, follow the below two steps to create and run the program.
1. Open a text editor, write the following "Hello World" program and save the file with .rb extension i.e. HelloWorld.rb
Hello World Program - HelloWorld.rb
class HelloWorld
def greetings
puts("Hello World")
end
end
obj = HelloWorld.new
obj.greetings
2. Run the ruby file (i.e. ruby program) using the command ruby HelloWorld.rb.