← Back to archive

Stdle #18 · enums · 2026-06-24

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(u8) { red = 1, green = 2, blue = 4 };
const c = Color.blue;
std.debug.print("{d}\n", .{@intFromEnum(c)});
}
Enums
4 attempts left

Answer & explanation