Last Modified: 2024-06-25 13:27:10Z
Table of Contents
2. Install
nix-shell -p zig
As you can see, you can try the Zig compiler in nearly any version you want.
nix-shell -p zig_0_10 # Zig v0.10.1
3. Writing a code and compiling it
This code below will print "Hello World" to the console.
// hello.zig
const std = @import("std");
pub fn main() void {
std.debug.print("Hello, {s}!\n", .{"World"});
}
You can instantly run the Zig code with zig run
command.
$ zig run hello.zig
Hello, World!