Skip to content

Instantly share code, notes, and snippets.

@gaplo917
Last active January 15, 2017 14:24
Show Gist options
  • Save gaplo917/5c62cdc0db4d1fe4d5e5724f7403969c to your computer and use it in GitHub Desktop.
Save gaplo917/5c62cdc0db4d1fe4d5e5724f7403969c to your computer and use it in GitHub Desktop.
Kotlin Functional Support 3
data class User(val id: Int, val name: String, val address: String)
val user = User(id = 1, name = "GARY LO", address = "Hong Kong")
// Destructing order is import!!
val (userId, userName, userAddress) = user
println("id = $userId, name = $userName, address = $userAddress")
// id = 1, name = GARY LO, address = Hong Kong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment