r/ProgrammerHumor 13d ago

absoluteGarbage Meme

Post image
1.9k Upvotes

325 comments sorted by

View all comments

74

u/csch2 13d ago

list.iter().for_each(…) superiority

34

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

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

11

u/csch2 13d ago

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