← Back to archive

Stdle #145 · option · 2026-10-29

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: ?u32 = null;
const y: u32 = x orelse blk: {
const fallback: u32 = 10 * 5;
break :blk fallback;
};
std.debug.print("{d}\n", .{y});
}
Option
4 attempts left

Answer & explanation