← Back to archive

Stdle #120 · control · 2026-10-04

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 x: i32 = -42;
const sign: i32 = if (x < 0) -1 else if (x > 0) 1 else 0;
std.debug.print("{d}\n", .{sign});
}
Control Flow
4 attempts left

Answer & explanation