4 ms·
Being clear about things is one of Zig's central philosophies, if naming things `foo_iter` and `bar_iter` doesn't feel like the right solution then maybe the la
by AnIdiotOnTheNet 4y ago
Being clear about things is one of Zig's central philosophies, if naming things `foo_iter` and `bar_iter` doesn't feel like the right solution then maybe the language isn't a good fit for you.
But also:
var iter = foo_dir.iterate();
while (try iter.next()) |entry| {
// Do something
}
iter = bar_dir.iterate();
while (try iter.next()) |entry| {
// Do something else
}
You can totally just reassign `iter` here since you're done with the first iterator (assuming they are both the same type, which appears to be the case).
- jeltz 4y agoI do not think long variable names is very clear. What is clear is locally scoped ones and there I feel Zig has some deficiencies which makes it unnecessarily cumbersome to have locally scoped iterators.