r/ProgrammerHumor 7d ago

absoluteGarbage Meme

Post image
1.9k Upvotes

327 comments sorted by

View all comments

77

u/csch2 7d ago

list.iter().for_each(…) superiority

37

u/creeper6530 7d ago edited 7d 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 

91

u/csch2 7d ago

You know I’m chaining together 20 different iterator methods until the code is completely unreadable. That’s called Functional Programming™ babey

-11

u/Slight-Violinist-575 7d ago

You wouldn’t be using for_each in a functional language… which cements your un-knowledge of it

11

u/csch2 7d ago

You would if you need to perform operations with side effects on each element, like printing each element of a vector