← Back to archive

Stdle #127 · integers · 2026-10-11

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: u32 = 0b10110;
const mask: u5 = @truncate(x);
std.debug.print("{d}\n", .{mask});
std.debug.print("{b:0>5}\n", .{mask});
}
Integers
2 lines
4 attempts left

Answer & explanation