First time coding with Ruby in a Windows 10 environment.
GitHub repository: Ruby-HelloWorld
Instructions
Download the latest version of Ruby with DevKit in this link.
Keep the default configuration and install it.
There is a second installation for Ruby components. Just press ENTER.
To see if Ruby is correctly installed, open the terminal and run:
ruby --version
The result will be:
Now you are ready to program in Ruby.
Create a file named hello_world.rb with the following code:
puts "Hello World!"
Run the file:
ruby .\hello_world.rb
The result will be:
There are other ways to print messages. Add these lines to the file:
print "Hello World!"
p "Hello World!"
Run it again and the result will be:
What happened?
puts writes the message in one line.
print writes the message without jumping to the next line.
p inspects the element.
Top comments (0)