Why doesn’t Zig have C-style `for` loops?

Been suggested many times and rejected each time.

Potentially relevant:

Adding a new feature just to save a few lines of code isn’t really what Zig is interested in in my experience. Note also that for loops that work on ranges (e.g. for (0..end_index) |i| {) only got added as a side-effect of a different change with other use cases in mind: Proposal: Multi-object `for` loops · Issue #7257 · ziglang/zig · GitHub

6 Likes