Zig Programming Lessons

Choose your path and start learning Zig programming step by step.

intermediate

Error Handling

Master Zig's error handling system with error unions, error sets, try/catch, and errdefer

22 min read
1 prerequisites

Memory and Allocators

Understand Zig's memory model with stack vs heap allocation, allocators, and manual memory management

28 min read
1 prerequisites

Comptime

Harness Zig's compile-time evaluation for metaprogramming, generic code, and zero-cost abstractions

25 min read
2 prerequisites

Optionals and Unions

Work with optional types, null safety, tagged unions, and pattern matching in Zig

22 min read
1 prerequisites

Slices and Iteration

Master slices, sentinel-terminated types, iterators, and std.mem utilities in Zig

22 min read
1 prerequisites

Pointers And References

Master Zig's explicit pointer model — taking addresses, dereferencing, pointer types, and passing data by reference to write efficient and correct low-level code

28 min read
3 prerequisites

String Handling

Understand how Zig represents and manipulates strings as byte slices — comparing, searching, iterating, and building strings with the standard library

25 min read
4 prerequisites

Generics And Anytype

Learn how Zig achieves generic programming through comptime type parameters and anytype — writing flexible, reusable code without runtime overhead or implicit boxing

25 min read
4 prerequisites

File IO

Learn how to read and write files in Zig using std.fs, handle I/O errors gracefully, and use buffered I/O for efficient file operations

20 min read
4 prerequisites

Data Structures

Build and use common data structures in Zig with std.ArrayList and std.HashMap, and write your own generic collections using comptime type functions

25 min read
5 prerequisites

Packaging and Modules

Understand Zig's module system — file-based modules, @import, pub visibility, build.zig.zon package manifests, and structuring projects for reuse

22 min read
5 prerequisites