Created
March 28, 2021 20:57
-
-
Save cioccarellia/94e249c965999b50c811d6887970d4fe to your computer and use it in GitHub Desktop.
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
// Standard | |
val bob = Person("Bob", 19, "Texas") | |
println(bob) | |
bob.moveTo("Florida") | |
bob.incrementAge() | |
bob.alias = "Bravo" | |
println(bob) | |
// Using apply | |
val alice = Person("Alice", 19, "Italy").apply { | |
println(this) | |
moveTo("France") | |
incrementAge() | |
alias = "Alpha" | |
println(this) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment