Hello.
I’m trying to run a sample from the Kotlin reference.
This one works:
fun main(args: Array<String>) {
val adHoc = object {
var x : Int = 0
}
print(adHoc.x)
}
And this one not (has not been compiled because of unresolved reference adHoc.x):
val adHoc = object { var x : Int = 0 }
fun main(args: Array<String>) { print(adHoc.x) }
Why? What’s the difference?
Thanks, Alexey