Created
November 8, 2021 18:53
-
-
Save manoj-mili/e043209caa25ee01f805fb8f8542f496 to your computer and use it in GitHub Desktop.
Avoid Passing Too many arguments
This file contains 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
// Don't pass too many arguments | |
fun saveUserDetails( | |
firstName: String, | |
lastName: String, | |
phoneNumber: String, | |
gender: String, | |
age: Int | |
) {} | |
// Do create a type and pass it as function param | |
data class User( | |
val firstName: String, | |
val lastName: String, | |
val phoneNumber: String, | |
val gender: String, | |
val age: Int | |
) | |
fun saveUserDetails(user: User) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment