← Back to archive

Stdle #85 · unions · 2026-08-30

What does this Zig snippet output?

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

const std = @import("std");
const Tagged = union(enum) {
int: i32,
float: f64,
none,
};
pub fn main() void {
const t = Tagged{ .int = 42 };
std.debug.print("{s}\n", .{@tagName(t)});
}
Unions
4 attempts left

Answer & explanation