← Back to archive

Stdle #164 · control · 2026-11-17

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 i: u32 = 1;
const result: u32 = while (i < 10) : (i *= 2) {
if (i >= 8) break i;
} else 0;
std.debug.print("{d}\n", .{result});
}
Control Flow
4 attempts left

Answer & explanation