Learn Ruby fundamentals by fixing broken code. Inspired by Ziglings.
- Ruby 3.4+ — exercise 016 prints a hash, and 3.4 changed how hashes display
- Clone this repo
- Run
bin/rubites - Fix the first broken exercise
- Run
bin/rubitesagain - Repeat until all 35 exercises pass!
Each exercise in exercises/ has broken or incomplete Ruby code. The comments explain the concept and tell you what the expected output should be. Fix the code, run the runner, and move on.
If you get stuck, check the solutions/ directory for reference answers.
| Exercises | Topic |
|---|---|
| 001-003 | Variables & Types |
| 004-006 | Strings |
| 007-009 | Numbers & Booleans |
| 010-012 | Control Flow |
| 013-015 | Arrays |
| 016-018 | Hashes & Ranges |
| 019-021 | Iteration |
| 022-024 | Methods |
| 025-027 | Blocks, Procs, Lambdas |
| 028-030 | Classes & Objects |
| 031-032 | Modules & Mixins |
| 033-034 | Error Handling |
| 035 | Pattern Matching |
Completed the fundamentals? Try the senior track:
bin/rubites --senior
These exercises cover advanced Ruby concurrency — Fibers and Ractors. No solutions provided (yet).
| Exercises | Topic |
|---|---|
| 001-003 | Fibers |
| 004-006 | Ractors |
The runner tracks your progress automatically - it runs through exercises in order and stops at the first one that fails.
ruby test/solutions_test.rb
Runs every solution and checks it prints what its exercise promises, so a broken exercise or a wrong "Expected output" line can't go unnoticed. It also checks the exercises are still shipped unsolved.
Pull requests welcome! If you'd like to add exercises, follow the format in the existing files.
MIT