← Back to archive

Stdle #110 · structs · 2026-09-24

What does this Zig snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

const std = @import("std");
const Pair = struct {
a: i32,
b: i32,
fn min(self: Pair) i32 {
return @min(self.a, self.b);
}
fn max(self: Pair) i32 {
return @max(self.a, self.b);
}
};
pub fn main() void {
const p = Pair{ .a = 7, .b = 3 };
std.debug.print("{d} {d}\n", .{ p.min(), p.max() });
}
Structs
4 attempts left

Answer & explanation