Initialize top variable with a code snippet

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 */ }()
1 Like

Nice, thanks