← Back to archive

Stdle #176 · integers · 2026-11-29

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 {
var sum: i32 = 0;
for ([_]i32{ 1, 2, 3, 4 }) |x| {
sum += x;
}
std.debug.print("{d}\n", .{sum});
}
Integers
4 attempts left

Answer & explanation