Zig Programming Lessons
Choose your path and start learning Zig programming step by step.
basics
Introduction to Zig
Learn the basics of Zig programming language and why it's becoming popular for systems programming
Variables and Data Types
Learn about variables, mutability, and Zig's powerful type system
Functions
Learn how to define and use functions in Zig, including parameters, return values, and error handling
Control Flow
Master if statements, loops, and switch expressions in Zig
Arrays and Structs
Learn how to work with arrays, slices, and structs to organize your data in Zig
Enums And Tagged Unions
Learn how to model state and variant data using Zig's powerful enum and tagged union types
intermediate
Error Handling
Master Zig's error handling system with error unions, error sets, try/catch, and errdefer
Memory and Allocators
Understand Zig's memory model with stack vs heap allocation, allocators, and manual memory management
Comptime
Harness Zig's compile-time evaluation for metaprogramming, generic code, and zero-cost abstractions
Optionals and Unions
Work with optional types, null safety, tagged unions, and pattern matching in Zig
Slices and Iteration
Master slices, sentinel-terminated types, iterators, and std.mem utilities in Zig
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
String Handling
Understand how Zig represents and manipulates strings as byte slices — comparing, searching, iterating, and building strings with the standard library
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
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
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
Packaging and Modules
Understand Zig's module system — file-based modules, @import, pub visibility, build.zig.zon package manifests, and structuring projects for reuse
advanced
File I/O
Read and write files, work with directories, and use buffered I/O in Zig
Testing
Write tests in Zig using built-in test blocks, std.testing, and the test allocator
Build System
Use Zig's build system with build.zig, build steps, dependencies, and compile options
C Interop
Call C functions from Zig, work with C types, and link C libraries
Capstone Project
Build a command-line utility combining all Zig concepts from the course
Interfaces and Vtables
Learn how Zig achieves polymorphism without a built-in interface keyword — using tagged unions for closed dispatch and structs of function pointers (vtables) for open, runtime polymorphism
SIMD and Vectors
Harness Zig's first-class SIMD support — learn @Vector types, element-wise operations, reductions, and how to write data-parallel code that compiles to real CPU vector instructions
Error Handling Patterns
Master Zig's error handling system — error sets, error unions, try and catch, errdefer for cleanup, and composing reliable functions that fail gracefully