Learn Crystal, a fast compiled language with friendly Ruby-like syntax, from your first puts to a small project, with every exercise checked as you go.
8 lessons, 16 exercises. Runs Crystal 1.22.
Not started
Hello, output
Print text with puts and print, add comments, and see how Crystal compiles and runs your program.
Values and variables
Meet Crystal's basic types, store values in variables and constants, and let the compiler infer types for you.
Reading input and arithmetic
Read lines from standard input with read_line and gets, convert text to numbers, and do maths with Crystal's operators.
Making decisions
Choose between paths with if, elsif, unless and case, and combine conditions with comparison and boolean operators.
Loops
Repeat work with while loops, ranges and blocks, and leave early with break and next.
Functions
Define methods with def, add type restrictions and default values, return results, and learn what a method can see.
Collections
Store many values in arrays and hashes, and transform them with Crystal's block-based methods.
Strings and a small project
Slice, search and transform strings, then combine everything so far into a receipt printer.
Your progress is saved in this browser. Sign in to keep it on every device.