← Back to archive

Stdle #169 · control · 2026-11-22

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 arr = [_]i32{ 5, 10, 15, 20 };
for (arr, 0..) |val, i| {
if (val > 12) {
std.debug.print("{d}\n", .{i});
break;
}
}
}
Control Flow
4 attempts left

Answer & explanation