Non-overlapping scopes

Report a typo

Look at the code below:

fun example() {
    val interesting = 0
}

fun main() {
    println(interesting)
}

Can we access exactly the interesting variable (not another variable with the same identifier) from the main() function like this? Or is there anything wrong?

Select one option from the list
___

Create a free account to access the full topic