Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Zig Fundamentals - The Complete Guide
Rating: 2.9 out of 5(4 ratings)
28 students

Zig Fundamentals - The Complete Guide

Learn Zig quickly as a high-level programmer, get proficient enough to write full projects in Zig
Created byNavid Momtahen
Last updated 11/2025
English

What you'll learn

  • Learn fundamental Zig constructs
  • Learn the Zig standard library and how to use it
  • Learn to write idiomatic Zig
  • Apply Zig programming knowledge to a range of problem domains via projects

Course content

4 sections • 40 lectures • 2h 33m total length
  • Introduction - Setup, Hello World, Variables4:53

    Explore why Zig appeals to non-systems programmers, highlighting performance, safety, explicit error handling, compile-time evaluation with CompTime, const versus var, and Hello World setup with Homebrew or Scoop.

  • Data Types1:52

    Explore Zig data types—strings, floats, arrays, and integers—and learn to print them with s and d format specifiers, while inferring arrays and using i8, i16, i64, and u variants.

  • Mutable and Immutable Variables1:30

    Learn how Zig handles mutable and immutable values with const and var, and how i32 and f64 annotations influence compilation and constant window dimensions.

  • Control Flow2:18

    Explore control flow constructs—if, while, and for—and learn to write conditions with mandatory parentheses, space between the operator and operands, use of integers and variables, and printing iterative results.

  • Function Definitions1:58

    Explore defining functions in zig with fn and pub, specify parameter types after a colon, declare a return type, and build a function body with examples like add and print.

  • Comments1:18

    Explore the three Zig comment types—file-level, inline, and documentation—describing what they cover and why you write comments to explain intent over implementation.

  • Handling Stdin and Stdout Streams2:41

    Learn to read input from stdin and write output to stdout in Zig, using reader and writer, handle error unions, and trim return and newline characters before printing.

  • Defer Keyword1:00

    Use the defer statement to execute code after a scope exits in Zig, causing actions to run in reverse order. This helps clean up resources, such as freeing allocator allocations.

  • Handling File I/O2:17

    Master Zig file I/O by reading files with read file alloc using the page allocator in the current working directory, then create, write all, append, overwrite, and delete files.

  • Arrays, Slices, and ArrayLists5:37

    Learn how Zig differentiates arrays and slices—the fixed-length, compile-time arrays and the runtime, mutable slices—then use std.arraylist with an allocator for appending and removing elements.

  • Iterating over Arrays, Slices and HashMaps4:12

    Iterate over Zig arrays, slices, and string hash maps using for loops and the standard library iterator, printing indexes, values, and floats with two decimal places.

  • Structs3:46

    Explore Zig structs and how to design data with imperative paradigms, avoiding inheritance and oop, using a cat struct with name and age and a say info method.

  • Enums2:59

    Define enums in Zig as a set of named constants using const name equals enum, and use them with a switch to print the corresponding string after compiling.

  • Tagged Unions3:38

    Discover how Zig's tagged unions provide safe, compile-time morphable data by modeling ok and error variants, then use switch statements to handle each case and print messages.

  • Generics3:04

    Explore generics in Zig by implementing a generic swap function that handles ints and floats, demonstrating type parameters and before and after results to show dynamic features.

  • Error Handling3:05

    Learn Zig error handling with or else and catch blocks, parse input, trim the new line and return character, and gracefully handle bad input to avoid crashes.

  • String Handling5:40

    Learn how to work with string literals and string handling in Zig, including const u8 literals, printing with the s format specifier, concatenation with strmem.concat, and formatting with alloc.print.

  • JSON Handling3:46

    Parse and access JSON values in Zig using std.json, then serialize data back to JSON, with examples of parsing strings, accessing root fields, and iterating feature arrays.

  • Optionals and Nullability1:17

    Discover optionals and nullability in Zig by using a question mark before an I32 type to represent a value or null, with control flow showing when a value is present.

  • Project - RPN Calculator10:11

    build a zig project to implement a reverse Polish notation calculator using a gpa allocator, arraylist of f64, and token input; includes stack operations and error handling.

Requirements

  • Basic IT literacy.
  • Basic understanding of imperative programming languages.

Description

TLDR: If you want to understand Zig concepts quickly and concisely and have basic programming knowledge, this is the right course to get.


The course is also being frequently updated to match the numerous API changes in Zig pre-1.0, and will expand in content over time. The version of Zig at the time of writing is 0.15.2.


This course is designed for intermediate programmers coming from high-level languages like Python, JavaScript, Ruby, or Java who are curious about diving into lower-level programming with the Zig language—without needing a background in systems programming or C.


Zig offers a modern, robust alternative to C, combining low-level control with clean, readable syntax and a focus on safety, performance, and simplicity. This course bridges the gap between high-level programming habits and the hands-on, memory-conscious world of Zig.


You’ll learn Zig’s core syntax and design philosophy, explore manual memory management (without fear), and understand how to write efficient, safe, and portable code. You'll also get a primer on build systems, error handling, and cross-compilation, all from a high-level programmer’s perspective.


Again, Who This Course Is For:


  • High-level language developers curious about systems-level programming

  • Web/backend/mobile developers wanting more control over performance

  • Programmers looking to write native code without diving into C/C++

  • Anyone interested in learning Zig with zero low-level background required


By the end of the course, you'll not only understand how Zig works but also how to think in Zig—by being fully able and capable of confidently writing powerful, efficient programs that are close to the metal, without the complexity of legacy systems languages.

Who this course is for:

  • Developers of higher-level languages who want to try a lower-level language such as Zig.