Kotlin: destructuring declarations

Example:

data class User(val name: String, val age: Int)
Destructuring allows you to break an object into multiple variables.

Solution:

val john = User("John", 25) val (name, age) = john

Beginner's Guide to Kotlin