Stdle #158 · errors · 2026-11-11
What does this Zig snippet output?
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
const std = @import("std");fn mayFail(x: i32) error{Bad}!i32 { if (x < 0) return error.Bad; return x + 10;}pub fn main() void { const a = mayFail(-1) catch 99; const b = mayFail(5) catch 99; std.debug.print("{d}\n", .{a}); std.debug.print("{d}\n", .{b});}Errors