Unlucky one

Report a typo

You have a variable named unlucky. Now its scope is the main() function.

Redefine unlucky so that it becomes a top-level variable with a scope one level higher.

______________________

This is usually not a good idea. However, the task is needed to understand what a top-level variable is.

Write a program in Kotlin
fun main() {
val unlucky = "My scope should change!"
// do not change the code below
check()
}
___

Create a free account to access the full topic