← Back to archive

Stdle #125 · comptime · 2026-10-09

What does this Zig snippet output?

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

const std = @import("std");
fn isEven(comptime T: type, val: T) bool {
return @mod(val, 2) == 0;
}
pub fn main() void {
std.debug.print("{} {}\n", .{ isEven(i32, 42), isEven(i32, 7) });
}
Comptime
4 attempts left

Answer & explanation