https://kotlinlang.org logo
b

bum

01/20/2020, 11:36 AM
Is there any different between
top level variable
and
local variable
?
Copy code
val outer = 1

fun main() {
    val inner = 2
    
    println(::outer.name) // outer
    println(::inner.name) // [References to variables aren't supported yet]
}
I'm confused why
println(::inner.name)
throws error 😕
s

spand

01/20/2020, 11:51 AM
top level is a property, not a variable
👍 2
b

bum

01/20/2020, 11:53 AM
thanx for ur help 🙂
2 Views