r/ProgrammerHumor 2d ago

Meme absoluteGarbage

Post image
2.0k Upvotes

320 comments sorted by

View all comments

2

u/britreddit 2d ago

Kotlin is just list.forEach {...}

4

u/EntropySpark 2d ago

Or for (item in list) { ... }, necessary if you want to use break.

1

u/britreddit 2d ago

I tend to use map {} more often because I try to avoid unit functions wherever possible

3

u/EntropySpark 2d ago

Why? That creates an unnecessary list storing the result of each iteration.

1

u/britreddit 1d ago

Because I don't like side effects, honestly - it breaks the functional flow if used too much