Learn Swift from your first print() to a small text-report project, with every exercise checked as you go.
8 lessons, 16 exercises. Runs Swift 6.4.
Not started
Hello, output
Print text to the screen, add comments, and see how a Swift program runs from top to bottom.
Values and variables
Store values in constants and variables, learn Swift's basic types, and build text with string interpolation.
Reading input and arithmetic
Read lines from standard input with readLine(), turn text into numbers safely, and do math with Swift's operators.
Making decisions
Choose what your program does with if, else and switch, using comparisons and the logical operators &&, || and !.
Loops
Repeat work with for-in over ranges, while and repeat-while loops, and leave a loop early with break and continue.
Functions
Package code into reusable functions with parameters, argument labels, default values and return values, and learn where names are visible.
Collections
Keep many values together in arrays and dictionaries, add and look up items, and loop over them.
Strings and a small project
Inspect, transform, split and join text with Swift's String API, then build a word-statistics report that uses everything from the core path.
Your progress is saved in this browser. Sign in to keep it on every device.