Re:A Review of the Zig Programming Language (Using Advent of...
by ReactiveJelly on Monday December 27, 2021 @06:50PM
(#29708402)
Lua also has
for i, v in ipairs (t) do
-- i is the index, v is the value
end
Not getting the index in C++ easily was very frustrating. Often in C++ I fall back on C-style for-loops just because the functional stuff is hard to remember.In Rust it doesn't give you the index by default, but the `enumerate` adapter adds an index anywhere in a functional pipeline.
I suppose it could have been
But I guess coming from Python that feels like tuple unpacking, which I don't think Zig has, but could make sense?