⚡ Zig Guide LiveUnofficialbut fully verified
✓ Zig 0.17.0-dev.1525+91c6d8a09What's newOn an older Zig?

About this guide

Zig Guide Live is a tutorial and cookbook for the Zig programming language. Every code example on it was compiled and executed by a machine against Zig 0.17.0-dev.1525+91c6d8a09 before this page was published, and the artifact that ran in that check is the one your browser downloads when you press Run.

Why it exists

Zig has no stable release, and the language is still moving underneath everything written about it. Between the last tagged releases and today,pub fn main() gained a parameter, writers became buffered and have to be flushed, std.fs.File became std.Io.Fileand started taking an Io, the ** array-repeat operator was removed outright, and ArrayList stopped holding an allocator. Each of those breaks the first program in most Zig tutorials that exist.

The usual failure is quiet. A tutorial is written against whatever compiler its author had, it is correct for a few months, and then it is wrong with no visible sign that anything changed. A reader following it hits an error message that does not appear anywhere in the text, and has no way to tell whether they made a mistake or the page did.

This site is built so that failure is loud. There is no separate copy of the examples kept in prose: the pages embed the same files the build compiles, so a snippet that stopped working cannot be published at all. When Zig master changes something, the build goes red, and the fix is to teach the new shape and say what the old one was. That delta is usually the most useful thing on the page for anyone arriving from an older tutorial.

How it is built

207 snippets live as ordinary .zig files in the repository. A build step compiles every one of them, runs the ones that can be run, and compares their output against a recorded expected result. Only if all of that passes does the site build at all, and only then is it published. The same check runs again every night against a freshly built compiler, so the guide proves itself correct today rather than on the day it was last edited.

The full mechanism, including what happens to snippets that cannot run in a browser and the three that are required to fail, is written up in how this guide is verified.

Who writes it

Rajesh Pillai. It is one person's work, written with AI assistance and then verified: every code example by the build described above, and the prose by a team of engineers before it is published. The machine checks that the code is correct; people check that the explanation is.

It is not affiliated with the Zig Software Foundation. The official language documentation is at ziglang.org, and that is the reference this guide defers to on any point where the two disagree.

The source, including every snippet and the build that checks them, is public at github.com/rajeshpillai/zig-guide. If something here is wrong, it can be checked and corrected in the open; see contact.

What it is not

  • Not a language reference. It teaches by running programs and explaining what they did. Where you need the exact rule, the official reference and the standard library source are better.
  • Not a guide to a tagged release. Code here targets master. On 0.14 or 0.15 much of it will not build, which is what coming from an older Zig is for.
  • Not stable in the way a book is. Chapters change when the compiler does. The version in the footer is always the compiler that verified what you are reading, and what's new lists what moved.
  • Not published unreviewed. Drafting uses AI assistance; nothing reaches the site on that basis alone. The code is proved by the build, and the prose is read by engineers who can tell whether the explanation is right.

Reading it

There are four tracks and one reading order through all of them. The arrows at the foot of every chapter follow that order, so the guide can be read straight through. If you already know what you are here for, the reading paths pick a route for five common starting points, and the guide index lists every section.

Read the guide →