← Back to archive

Stdle #143 · comptime · 2026-10-27

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 {
comptime var sum: u32 = 0;
inline for (.{ 1, 2, 3, 4, 5 }) |x| {
sum += x;
}
std.debug.print("{d}\n", .{sum});
}
Comptime
4 attempts left

Answer & explanation