Last active
January 15, 2017 14:24
-
-
Save gaplo917/5c62cdc0db4d1fe4d5e5724f7403969c to your computer and use it in GitHub Desktop.
Kotlin Functional Support 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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