Learn Go from your first fmt.Println to interfaces, slices and a small inventory project, with every exercise checked as you go.
15 lessons, 30 exercises. Runs Go 1.26.
Not started
Hello, output
Write your first Go program, print text with the fmt package, and add comments.
Values and variables
Store values in typed variables, use short declarations and constants, and learn Go's zero values.
Reading input and arithmetic
Read numbers and text from standard input with fmt.Scan and bufio, convert them, and do arithmetic.
Making decisions
Choose what your program does with if, else and switch, using comparison and boolean operators.
Loops
Repeat work with Go's single for keyword, range over numbers, and stop early with break and continue.
Functions
Package code into named functions with parameters and multiple return values, and understand variable scope.
Collections
Hold many values with arrays, slices and maps, and loop over them with range.
Strings and a small project
Work with text using the strings package, bytes and runes, then combine everything in a small word-stats program.
Handling errors
Treat errors as ordinary values, check them where they happen, create your own, and wrap them with context.
Structuring data
Group related values into structs, attach methods to them, and choose between value and pointer receivers.
Recursion
Solve problems by having a function call itself on a smaller piece, with a base case that stops it.
Sorting and searching
Sort slices with the slices package and custom comparison functions, and find items fast with binary search.
Maps and sets in depth
Use maps for counting and grouping, build sets from maps, and combine sets with union, intersection and difference.
Interfaces and slices
Write code that works with any type through Go's implicit interfaces, and understand how slices share and grow their storage.
Final project: shop inventory
Build a command-driven inventory program that combines structs, maps, sorting, errors and input parsing.
Your progress is saved in this browser. Sign in to keep it on every device.