← Back to archive

Stdle #45 · strings · 2026-07-21

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 s: []const u8 = "hello world";
if (std.mem.indexOf(u8, s, "world")) |idx| {
std.debug.print("{d}\n", .{idx});
}
}
Strings
4 attempts left

Answer & explanation