Destructuring
Pull values from pairs, data classes and maps into variables.
Example
val (a, b) = Pair(1, "x")
val (name, age) = "Ada" to 30
println("$a $b $name $age")
for ((k, v) in mapOf("p" to 1)) println("$k=$v")Exercise
Unpack a pair.
val (x, ) = pair
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.