Ruby Tutorial

By Xah Lee. Date: . Last updated: .
There is a gem called Ruby.
Shiny and pretty.
Objectively beautiful,
Functionally magical.
Make Rails of web happy.
Ruby logo
Ruby logo

This is a example-based ruby tutorial for beginners.

I assume you already know a scripting language. (e.g. Python, JavaScript) This intro is designed to quickly get you started. After reading, you should be able to use standard documentation.

Ruby has a interactive command line. In terminal, type irb

This tutorial is based on Ruby 3.

Table of Contents

Print

String

Types

Variable

Boolean

Branching

Loop, Iteration

Data Structure

Function

Class

Module

Misc