Welcome to the Ruby tutorial.

Computer programs consist of many machine instructions. Nobody has time to write machine instructions, so programming languages have been designed. One of these languages is Ruby.

Download Free Ruby Ebook

Quick Start

Create the hello world app

We create a program that outputs “Hello, World” to the screen.

Copy the code below and save the file as hello.rb

1
2
3
#!/usr/bin/ruby -w

puts "Hello, World!";

Then run the program with:

1
ruby hello.rb

If the program runs fine, you’ll see this output:

Exercises

  1. Create a program that outputs your name
  2. Create a program that outputs your address (multiple lines).