What does this print?
data class Point(
val x: Int, val y: Int
)
fun main() {
val p = Point(3, 7)
val (a, b) = p
println(a + b)
}
Try it in the online Kotlin Playground →
[spoiler title="Solution"]
Answer:
10
Explanation:
Data classes auto-generate destructuring for properties.
[/spoiler]