← Back to archive

Stdle #122 · errors · 2026-10-06

What does this Zig snippet output?

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

const std = @import("std");
fn parse(b: bool) !i32 {
if (b) return error.Bad;
return 7;
}
pub fn main() void {
const v = parse(true) catch -1;
std.debug.print("{d}\n", .{v});
}
Errors
4 attempts left

Answer & explanation