© 2026 Dometrain. All rights reserved.
Learn Zig by writing small functions in your browser, from integer types and slices to error unions, structs, allocators and memory you free yourself.
Zig has no garbage collector, no hidden allocations and no exceptions, and its compiler is strict about small things too: an unused variable stops the build, / will not divide two signed integers, and a u8 pushed past 255 halts the program in a debug build. Those rules are easier to learn by running into them in your own code than by reading a list of them.
Zig for Beginners has 26 short exercises, each solved in an editor in your browser. Every lesson shows one part of the language on a small example of its own, and then you write a function that uses it; Run compiles your file and checks the function against a set of inputs. The first two chapters cover functions, const and var, explicit integer widths and casts, if expressions, while and for loops with labeled continue, and switch. After that you work with slices, fixed-size arrays and text as []const u8, then handle missing values and failures with optionals, error sets, try and catch. Chapter five models data with structs, methods, enums and tagged unions, plus a generic function built with comptime. The last chapter is about memory you manage yourself: an allocator passed in as a parameter, defer and errdefer, std.ArrayList, std.StringHashMap, and slices you return for the caller to free. When a function takes memory from the allocator it is given and never frees it, Run reports the leak, so the mistake shows up while the function is still fresh in your head.
It is written for developers who already program in another language and are new to Zig. There is nothing to install, and every example sticks to syntax and library calls that build unchanged on Zig 0.17.0, the stable release the course was written for.