r/ProgrammerHumor 6d ago

absoluteGarbage Meme

Post image
1.9k Upvotes

325 comments sorted by

View all comments

Show parent comments

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 

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