Stdle #159 · enums · 2026-11-12
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 Color = enum { red, green, blue, yellow }; std.debug.print("{d}\n", .{@intFromEnum(Color.red)}); std.debug.print("{d}\n", .{@intFromEnum(Color.blue)}); std.debug.print("{d}\n", .{@intFromEnum(Color.yellow)});}Enums