Skip to content

Instantly share code, notes, and snippets.

@PriyaSindkar
Last active August 24, 2022 09:35
Show Gist options
  • Select an option

  • Save PriyaSindkar/9cfdc4ee33b5eb49695d9d7979551e80 to your computer and use it in GitHub Desktop.

Select an option

Save PriyaSindkar/9cfdc4ee33b5eb49695d9d7979551e80 to your computer and use it in GitHub Desktop.
Kotlin- Scoped Functions example
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