Getting Started with Zig
Installation
First, let's install Zig on your system. Choose your platform:
macOS (using Homebrew):
brew install zig
Linux:
sudo snap install zig --classic
Hello World
Let's create your first Zig program:
const std = @import("std");
pub fn main() void {
std.debug.print("Hello, World!\n", .{});
}
Code Breakdown:
-
const std = @import("std");
- Imports the standard library pub fn main()
- Declares the main function-
std.debug.print()
- Prints to standard output