Your First Ruby Program
Let’s create a simple Ruby script to display text.
Steps:
- Create a file named
hello.rb
- Add the following code:
puts "Hello, world!"
Run the File:
In terminal or command prompt:
ruby hello.rb
This will print:
Hello, world!
puts is a Ruby method used to print output to the console.