Is there a way to initialize a top non-optional variable with a snippet of code other than using lazy
?
In Kotlin I can simply val x = run { ... }
to say
Is there a way to initialize a top non-optional variable with a snippet of code other than using lazy
?
In Kotlin I can simply val x = run { ... }
to say
If I understood what you want to do, you can immediately evaluate a closure.
E.g.
let value = { /* snippet */ }()
Nice, thanks