Created
May 3, 2018 07:22
-
-
Save sajjadyousefnia/bfc9be261b4e4106f02b90fed810ce1b to your computer and use it in GitHub Desktop.
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
fun getUserNameAndState(id: Int): Pair<String?, String?> { | |
require(id > 0, { "Error: id is less than 0" }) | |
val userNames: Map<Int, String> = mapOf(101 to "Chike", 102 to "Segun", 104 to "Jane") | |
val userStates: Map<Int, String> = mapOf(101 to "Lagos", 102 to "Imo", 104 to "Enugu") | |
val userName = userNames[id] | |
val userState = userStates[id] | |
return Pair(userName, userState) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment