<https://twitter.com/kotlin/status/117464688488067...
# announcements
c
Any difference between this and
list.forEachIndexed{}
? Is one more performant/creates less objects or something?
j
as much as i love map, i hate forEach, but i would probably arrange my code so that foreach works in all but the most necessary cases where the for-loop has a scoping advantage over a lambda
subjectively speaking, the destructuring declaration looks more expression-calculus-like. fun main() { val list = listOf('A', 'B', 'C') for ((index, value) in list.withIndex()) { println("$index: $value") } list.forEachIndexed{index ,value-> println("$index: $value") } }