Hacker News new | ask | show | jobs
by wladimir 5329 days ago
You know how you're always supposed to store an Array's length in a `var` when looping with a `for` statement?

In this case, why not use the 'foreach' or iterator paradigm?

IMO, It's brain dead that programmers have to worry about such details in the first place. It is the task of the programming language to automate best practices that can easily be automated, and to not have to state them every single time. That increases overall productivity and also reduces bugs/mistypes.

1 comments

> why not use the 'foreach' or iterator paradigm?

I totally agree, and I do use when it's available in a given lang I'm working in/it's not overly cumbersome (some implementations miss the point).