Stdle #52 · comptime · 2026-07-28
What does this Zig snippet output?
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
const std = @import("std");fn add(a: anytype, b: @TypeOf(a)) @TypeOf(a) { return a + b;}pub fn main() void { std.debug.print("{d}\n", .{add(@as(u8, 100), 50)}); std.debug.print("{d}\n", .{add(@as(i32, -10), 30)});}Comptime