🎓 A1Learner
🔍
0 of 46 lessons completed

Zig Advanced Introduction

Zig Advanced is a course that builds on Zig Beginner and Zig Intermediate. It covers advanced comptime, advanced memory, advanced concurrency, SIMD, advanced build system, advanced C interop, safety and performance, and projects.

A First Advanced Program

This program prints a welcome line. It uses only ideas from earlier courses.

const std = @import("std");
pub fn main() !void {
    const out = std.io.getStdOut().writer();
    try out.print("Welcome to Zig Advanced.\n", .{});
}

Adding Numbers

This program adds two numbers and prints the total. The total is a plain sum.

const std = @import("std");
pub fn main() !void {
    const out = std.io.getStdOut().writer();
    const a: u32 = 17;
    const b: u32 = 25;
    try out.print("{}\n", .{a + b});
}

A Small Struct

This program holds a lesson name and its length in minutes. It prints both values on one line.

const std = @import("std");
const Lesson = struct { name: []const u8, minutes: u32 };
pub fn main() !void {
    const out = std.io.getStdOut().writer();
    const lesson = Lesson{ .name = "Intro", .minutes = 3 };
    try out.print("{s} {}\n", .{ lesson.name, lesson.minutes });
}

Example

const std = @import("std");
pub fn main() !void {
    const out = std.io.getStdOut().writer();
    const total: u32 = 46;
    try out.print("Zig Advanced has {} lessons.\n", .{total});
}

Key points

  • Zig Beginner and Zig Intermediate are the starting point for this course.
  • Each lesson teaches one idea with short examples and one closing example.
  • An exercise at the end of each lesson checks the main idea.
  • Later lessons use ideas from earlier lessons, so the course order matters.
  • The course starts with advanced comptime, then moves to advanced memory.
  • The later parts cover advanced concurrency, SIMD, and advanced build system, before advanced C interop, safety and performance, and projects.

The program stores the lesson count in a constant. It prints the count in a single sentence. The count covers every part of the course, from the first lesson to the final projects.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What comes before Zig Advanced in this course series?