Stdle #30 · enums · 2026-07-06
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 E = enum(u8) { a = 1, b = 2, c = 4, d = 8 }; const val: u8 = @intFromEnum(E.c) | @intFromEnum(E.d); std.debug.print("{d}\n", .{val}); std.debug.print("{b:0>8}\n", .{val});}Enums