Stdle #167 · slices · 2026-11-20
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 arr = [_]i32{ 1, 2, 3, 4, 5, 6, 7, 8 }; const sub = arr[2..6]; var sum: i32 = 0; for (sub) |v| sum += v; std.debug.print("{d}\n", .{sum});}Slices