Learn Ruby from your first puts to a small receipt-printing project, with every exercise checked as you go.
8 lessons, 16 exercises. Runs Ruby 4.0.
Not started
Hello, output
Print text with puts and print, leave notes in comments, and see how Ruby runs a file from top to bottom.
Values and variables
Store numbers, text and true/false values in variables, name them well, and build text with interpolation.
Reading input and arithmetic
Read lines from standard input with gets, turn text into numbers, and do arithmetic with Ruby's operators.
Making decisions
Choose what your program does with if, elsif, unless and case, using comparisons and boolean operators.
Loops
Repeat work with times, each over a range, while and until, and leave a loop early with break and next.
Functions
Package code into methods with def, pass arguments in, get results back, and learn how Ruby scopes local variables.
Collections
Keep many values together in arrays and hashes, and transform them with each, map, select and friends.
Strings and a small project
Clean up, slice, search and pad strings, then combine everything so far into a small receipt printer.
Your progress is saved in this browser. Sign in to keep it on every device.