Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
S_A_Constructors.kt
class InitOrderDemo(name: String) {
val firstProperty = "First property: $name".also(::println)
init {
println("First initializer block that prints ${name}")
}
val secondProperty = "Second property: ${name.length}".also(::println)
init {
println("Second initializer block that prints ${name.length}")
}
}
InitOrderDemo("hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment