Last active
July 31, 2019 11:40
-
-
Save ch8n/35bd042e1bc5d46e6f04ea1e4b7313bf to your computer and use it in GitHub Desktop.
return types destrcuturing
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
// Destructuring declarations can also be used when working with return values: | |
fun getPerson() = Person("ch8n", 25) | |
val(name, age) = getPerson() | |
//Or let’s say we need to return two values from a function: | |
fun getInfo(): Pair<Int, String> = Pair("ch8n", 25) | |
val (name, age) = twoValuesReturn() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment