Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#Lazy property #3

Open
arnaudram opened this issue Oct 4, 2020 · 0 comments
Open

#Lazy property #3

arnaudram opened this issue Oct 4, 2020 · 0 comments

Comments

@arnaudram
Copy link

`class LazyProperty(val initializer: () -> Int) {
private val lazyValue : Int? = null // Trying to re-assign val property, should be changed to var property
get() {
if(field == null)
field = initializer()

     return field
    }

val lazy: Int get() = lazyValue!!

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant