Kotlin 2 · Collections and lambdas

Loop over a map

Destructure entries and ranges in for loops.

for ((name, age) in ages) println("$name is $age")
for (i in 1..3) println(i)

Official Kotlin 2 documentation

More collections and lambdas commands

All collections and lambdas commands · Kotlin 2 cheatsheet

Was this page helpful?