Free curriculum
Learn Zig, lesson by lesson
Learn Zig as a systems language: establish explicit control flow and data layout, then tackle errors, allocators, comptime, C interop, build tooling, and low-level performance.
The order makes memory and error handling prerequisites for later generic, interface, SIMD, packaging, and systems-project work.
Complete curriculum
Work in order, or open any lesson as a public reading reference. Interactive practice remains optional.
- Read lesson →
Lesson 1 · basics
Introduction to Zig
Learn how to install Zig and get started with systems programming — covers setup on macOS, Linux, and Windows plus your first program
- Position
- core · 15 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 2 · basics
Variables and Data Types
Master Zig variables and the Zig type system — declare const and var bindings, use type inference, and convert between numeric types safely.
- Position
- core · 20 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency, Data Modeling
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 3 · basics
Functions
Learn Zig functions — define function parameters and return types, use public vs private visibility, and pass function pointers for flexible code.
- Position
- core · 20 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency, Abstraction & Design
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 4 · basics
Control Flow
Master Zig control flow — use if expressions, while and for loops, and switch expressions with pattern matching to write concise, safe logic.
- Position
- core · 20 min
- Prerequisites
- None
- Outcomes
- Syntax Fluency
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 5 · basics
Arrays and Structs
Learn Zig arrays and structs — create fixed-size arrays, define structs with methods, and organize data structures for clean, efficient programs.
- Position
- core · 25 min
- Prerequisites
- None
- Outcomes
- Data Modeling, Syntax Fluency
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 6 · intermediate
Error Handling
Master Zig error handling — use error unions, error sets, try/catch, and errdefer to write robust code that fails gracefully without exceptions.
- Position
- core · 22 min
- Prerequisites
- Functions
- Outcomes
- Security & Robustness, Architecture & Maintainability
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 7 · intermediate
Memory and Allocators
Understand Zig memory management — compare stack vs heap allocation, use allocator interfaces, and avoid leaks with explicit manual memory control.
- Position
- core · 28 min
- Prerequisites
- Error Handling
- Outcomes
- Performance & Runtime
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 8 · intermediate
Zig Comptime — Compile-Time Programming Guide
Zig comptime tutorial — learn compile-time evaluation, comptime parameters, type reflection, and how to write generic zero-cost abstractions. Free tutorial with runnable examples.
- Position
- core · 25 min
- Prerequisites
- Functions, Arrays and Structs
- Outcomes
- Abstraction & Design, Performance & Runtime
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 9 · intermediate
Optionals and Unions
Learn the Zig optional type and null safety — use ?T to represent nullable values, unwrap safely with orelse and if, and preview tagged unions for values with more than two shapes.
- Position
- core · 22 min
- Prerequisites
- Control Flow
- Outcomes
- Data Modeling
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 10 · intermediate
Slices and Iteration
Master Zig slices and iteration — use fat pointers for safe array views, iterate with for loops, and leverage std.mem utilities for searching and splitting.
- Position
- core · 22 min
- Prerequisites
- Arrays and Structs
- Outcomes
- Data Modeling, Performance & Runtime
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 11 · advanced
Async I/O with std.Io
Learn Zig 0.16's async I/O model — thread Io through your code like an allocator, launch tasks with io.async, await futures, fan out with std.Io.Group, and cancel work you no longer need.
- Position
- core · 30 min
- Prerequisites
- Memory and Allocators
- Outcomes
- Production Delivery, Security & Robustness
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 12 · advanced
Testing
Write Zig unit tests using built-in test blocks and std.testing — run tests with zig test, assert values, and detect memory leaks automatically.
- Position
- core · 22 min
- Prerequisites
- Error Handling
- Outcomes
- Testing & Debugging
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 13 · advanced
Zig Build System — build.zig Tutorial
Learn the Zig build system — configure build.zig for compilation, testing, and dependencies without Make or CMake. Free hands-on tutorial with runnable examples.
- Position
- core · 25 min
- Prerequisites
- Functions
- Outcomes
- Production Delivery
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 14 · advanced
Zig C Interop — Call C from Zig Guide
Call C from Zig with zero overhead — use @cImport to include C headers, link C libraries, and pass data between Zig and C seamlessly. Free tutorial with examples.
- Position
- core · 28 min
- Prerequisites
- Memory and Allocators
- Outcomes
- Production Delivery, Performance & Runtime
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 15 · advanced
Capstone Project
Build a complete Zig command-line tool — combine allocators, error handling, slices, structs, and testing into a real data processing utility.
- Position
- core · 30 min
- Prerequisites
- Zig C Interop — Call C from Zig Guide
- Outcomes
- Architecture & Maintainability, Data Modeling, Production Delivery
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 16 · basics
Enums And Tagged Unions
Learn Zig enums and tagged unions — model state with named values, attach data to variants, and use exhaustive switch for type-safe dispatch.
- Position
- core · 25 min
- Prerequisites
- Arrays and Structs, Control Flow
- Outcomes
- Data Modeling
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 17 · intermediate
Pointers And References
Master Zig pointers — take addresses with &, dereference with .*, understand *T vs [*]T vs []T, and pass data by reference for efficient code.
- Position
- core · 28 min
- Prerequisites
- Variables and Data Types, Arrays and Structs, Memory and Allocators
- Outcomes
- Performance & Runtime, Syntax Fluency
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 18 · intermediate
String Handling
Learn Zig string handling — work with []const u8 byte slices, compare and search strings, iterate bytes, and build strings with std.fmt.
- Position
- core · 25 min
- Prerequisites
- Variables and Data Types, Arrays and Structs, Memory and Allocators, Pointers And References
- Outcomes
- Syntax Fluency, Data Modeling
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 19 · intermediate
Generics And Anytype
Learn Zig generics and anytype — write reusable, type-safe functions using comptime type parameters with zero runtime overhead.
- Position
- core · 25 min
- Prerequisites
- Variables and Data Types, Functions, Arrays and Structs, Zig Comptime — Compile-Time Programming Guide, Pointers And References
- Outcomes
- Abstraction & Design
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 20 · intermediate
Zig File I/O
Read and write files in Zig with std.Io.Dir — open file handles, use buffered readers and writers, manage directories, and handle I/O errors explicitly.
- Position
- core · 20 min
- Prerequisites
- Variables and Data Types, Functions, Error Handling, Pointers And References
- Outcomes
- Production Delivery, Security & Robustness
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 21 · intermediate
Data Structures
Use Zig data structures — build dynamic collections with std.ArrayList, store key-value pairs in std.HashMap, and create your own generic types.
- Position
- core · 25 min
- Prerequisites
- Variables and Data Types, Functions, Error Handling, Pointers And References, String Handling
- Outcomes
- Data Structures & Algorithms, Data Modeling
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 22 · advanced
Interfaces and Vtables
Implement Zig interfaces using vtables — use tagged unions for closed dispatch and function pointer structs for open, runtime polymorphism.
- Position
- core · 25 min
- Prerequisites
- Functions, Arrays and Structs, Enums And Tagged Unions, Pointers And References, Generics And Anytype
- Outcomes
- Abstraction & Design
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 23 · advanced
SIMD and Vectors
Use Zig SIMD with @Vector — perform element-wise operations, reduce vectors to scalars, and write data-parallel code targeting real CPU instructions.
- Position
- core · 25 min
- Prerequisites
- Variables and Data Types, Functions, Arrays and Structs, Zig Comptime — Compile-Time Programming Guide, Slices and Iteration
- Outcomes
- Performance & Runtime
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 24 · advanced
Error Handling Patterns
Go beyond basic Zig error handling — define custom error sets, use errdefer for cleanup, merge error sets, and switch on specific errors for recovery.
- Position
- core · 25 min
- Prerequisites
- Variables and Data Types, Functions, Error Handling, Pointers And References, Zig File I/O
- Outcomes
- Security & Robustness, Architecture & Maintainability
- Runtime / version
- 0.16.0
- Read lesson →
Lesson 25 · intermediate
Zig Packaging and Modules — Project Structure Guide
Structure Zig projects with modules — use @import for file-based modules, control visibility with pub, and manage packages with build.zig.zon. Free tutorial with examples.
- Position
- core · 22 min
- Prerequisites
- Variables and Data Types, Functions, Arrays and Structs, Zig Comptime — Compile-Time Programming Guide, Zig Build System — build.zig Tutorial
- Outcomes
- Production Delivery, Architecture & Maintainability
- Runtime / version
- 0.16.0