Last active
August 24, 2022 09:35
-
-
Save PriyaSindkar/9cfdc4ee33b5eb49695d9d7979551e80 to your computer and use it in GitHub Desktop.
Kotlin- Scoped Functions example
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
| class ScopeFunctionExample { | |
| data class Person( | |
| var name: String = "", | |
| var lastName: String = "", | |
| var address: String = "", | |
| var phoneNumber: String = "" | |
| ) | |
| val parentDoe = Person().apply { | |
| name = "Jane" | |
| lastName = "Doe" | |
| address = "India" | |
| phoneNumber = "+91-XXXXXXXXXX" | |
| } | |
| val johnDoe = parentDoe.copy(name = "John") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment