The program shape in Zig
The smallest Zig program: one import, a public main, two prints.
// @import wires in the standard library at compile time.
const std = @import("std");
pub fn main() void {
std.debug.print("Gull Rock light: keeper on duty\n", .{});
std.debug.print("Visitors welcome at {s} tide\n", .{"low"});
}
How it works
const std = @import("std")wires in the standard library at compile time.pub fn main() voidis the entry point the start code looks for.std.debug.printtakes a format string and an anonymous tuple.{}of arguments.
Keywords and builtins used here
constfnpubvoid
The run, in numbers
- Lines
- 7
- Characters to type
- 229
- Tokens
- 54
- Three-star pace
- 75 tpm
At the three-star pace of 75 tokens a minute, this run takes about 43 seconds.
Step 1 of 3 in Values, step 1 of 27 in Language basics.