Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Last active October 25, 2016 09:16
Show Gist options
  • Save sliskiCode/4192ce938bc616739df0e86f833f864b to your computer and use it in GitHub Desktop.
Save sliskiCode/4192ce938bc616739df0e86f833f864b to your computer and use it in GitHub Desktop.
Builders in Kotlin. Gist 6
class Person(val name: String, val surname: String, val age: Int = 0)
Person(name = "Peter", surname = "Slesarew") // <- name, surname are mandatory
Person(name = "Peter") // <- it does not compile
Person(surname = "Slesarew") // <- it does not compile
Person(age = 28) // <- it does not compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment