← Back to archive

Stdle #138 · control · 2026-10-22

What does this Zig snippet output?

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

const std = @import("std");
fn countDown(n: i32) i32 {
if (n <= 0) return 0;
return 1 + countDown(n - 1);
}
pub fn main() void {
std.debug.print("{d}\n", .{countDown(7)});
}
Control Flow
4 attempts left

Answer & explanation