Follow

"iterate" is a bad concept for 95% of use cases; it requires thinking about "steps" and aggregators and side-effects. List Comprehensions are usually much better, with the idea being "give me a collection of stuff, and I'll give you some other collection back." Many languages now have these as foreach (instead of for), map, and filter. Only on special occasions does an algorithm actually require consideration of each step in context of the other steps.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.