const std = @import("std"); const expect = std.testing.expect; test "for basics" { const items = [_]i32 {4,5,3,4,0}; var sum: i32 = 0; for(items, 0.. ) |value,_| { sum += value; } try expect(sum == 16); } ubuntu 22.04, snap zig version 0.10.1 , zig test 1.zig produces: 1.zig:7:12: error: expected ')', found ',' for(items, 0.. ) |value,_| { ^
Zig 0.10.1:
for(items) |value| {} for(items) |value, index| {}
for(items) |value| {} for(items, 0..) |value, index| {} for(as, bs, cs, ds, 0..) |a, b, c, d, index| {}