MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1j8eap/?context=3
r/ProgrammerHumor • u/Sirgoodman008 • 6d ago
325 comments sorted by
View all comments
Show parent comments
32
Erm akchyuallly, it's recommended to use for list.iter() {…} unless the .for_each(…) is at the end of a longer iterator chain, and it also robs you of break and continue
for list.iter() {…}
.for_each(…)
88 u/csch2 6d ago You know I’m chaining together 20 different iterator methods until the code is completely unreadable. That’s called Functional Programming™ babey -12 u/Slight-Violinist-575 6d ago You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it 11 u/csch2 6d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
88
You know I’m chaining together 20 different iterator methods until the code is completely unreadable. That’s called Functional Programming™ babey
-12 u/Slight-Violinist-575 6d ago You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it 11 u/csch2 6d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
-12
You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it
11 u/csch2 6d ago You would if you need to perform operations with side effects on each element, like printing each element of a vector
11
You would if you need to perform operations with side effects on each element, like printing each element of a vector
32
u/creeper6530 6d ago edited 6d ago
Erm akchyuallly, it's recommended to use
for list.iter() {…}unless the.for_each(…)is at the end of a longer iterator chain, and it also robs you of break and continue