← Back to archive

Stdle #80 · enums · 2026-08-25

What does this Zig snippet output?

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

const std = @import("std");
const E = enum(u8) { a = 10, b = 20, c = 30 };
pub fn main() void {
const v = @intFromEnum(E.c) - @intFromEnum(E.a);
std.debug.print("{d}\n", .{v});
}
Enums
4 attempts left

Answer & explanation