← Back to archive

Stdle #44 · option · 2026-07-20

What does this Zig snippet output?

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

const std = @import("std");
pub fn main() void {
const x: ?i32 = 42;
if (x) |v| {
std.debug.print("{d}\n", .{v});
} else {
std.debug.print("none\n", .{});
}
}
Option
4 attempts left

Answer & explanation