Last active
July 28, 2020 15:02
-
-
Save cioccarellia/e233425bf304f47a6d4ee6195d4c1074 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 alice = Person("Alice", 20, "Amsterdam") | |
println(alice) | |
alice.moveTo("Detroit") | |
alice.incrementAge() | |
alice.alias = "Ally" | |
println(alice) | |
// Using let | |
Person("Bob", 21, "Bruges").let { it -> | |
println(it) | |
it.moveTo("Toronto") | |
it.decrementAge() | |
it.alias = "B" | |
println(it) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment