DEV Community

Cover image for Ruby-HelloWorld
LUCIANO DE SOUSA PEREIRA
LUCIANO DE SOUSA PEREIRA

Posted on • Originally published at github.com

Ruby-HelloWorld

titulo

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.

print01

Keep the default configuration and install it.

print02

There is a second installation for Ruby components. Just press ENTER.

print03

To see if Ruby is correctly installed, open the terminal and run:

ruby --version

The result will be:

print04

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:

print05

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:

print06

What happened?

puts writes the message in one line.

print writes the message without jumping to the next line.

p inspects the element.

References

Top comments (0)