home

Learning Zig

Welcome to Learning Zig, an introduction to the Zig programming language. This guide aims to make you comfortable with Zig. It assumes prior programming experience, though not in any particular language.

Zig is under heavy development and both the Zig language and its standard library are constantly evolving. This guide targets the latest development version of Zig. However, it's possible for some of the code to be out of sync. If you've downloaded the latest version of Zig and have problems running some code, please report the issue.

  1. Chinese - by Jiacai Liu
  2. Russian - by dee0xeed
  3. Korean - by faultnote
  4. Brazilian Portuguese - by João Kitajima

  1. Installing Zig
  2. Language Overview - Part 1
  3. Language Overview - Part 2
  4. Style guide
  5. Pointers
  6. Stack Memory
  7. Heap Memory & Allocators
  8. Generics
  9. Coding In Zig
  10. Conclusion

Zig's download page includes pre-compiled binaries for common platforms. On this page you'll find binaries for the latest development release as well as for major releases. The latest release, which this guide tracks, can be found at the top of the page.

For my computer, I'll be downloading zig-macos-aarch64-0.12.0-dev.2777+2176a73d6.tar.xz. You might be on a different platform or a more recent release. After expanding the archive you should have a zig binary (in addition to other things) which you'll want to alias, or add to your path; whatever flow you're used to.

You should now be able to run zig zen and zig version to test your setup.