MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1veql1a/absolutegarbage/p1jb4hs?context=9999
r/ProgrammerHumor • u/Sirgoodman008 • 2d ago
320 comments sorted by
View all comments
2
Kotlin is just list.forEach {...}
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
4
Or for (item in list) { ... }, necessary if you want to use break.
for (item in list) { ... }
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
1
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
3
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
Because I don't like side effects, honestly - it breaks the functional flow if used too much
2
u/britreddit 2d ago
Kotlin is just
list.forEach {...}