Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas

PatilShreyas/LazyDemo.kt Secret

Created Dec 29, 2020
Embed
What would you like to do?
val value by lazy {
println("Assigning a value")
10
}
fun main() {
println(value) // prints "Assigning a value 10"
println(value) // prints "10"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment