Skip to content

Instantly share code, notes, and snippets.

@cioccarellia
Last active July 28, 2020 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cioccarellia/e233425bf304f47a6d4ee6195d4c1074 to your computer and use it in GitHub Desktop.
Save cioccarellia/e233425bf304f47a6d4ee6195d4c1074 to your computer and use it in GitHub Desktop.
// 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