Open chest in Hogwarts

Report a typo

Hogwarts School of Witchcraft and Wizardry has a teacher whom the students call Mad-Eye. Now, Barty Crouch is hiding under this name. However, the real Mad-Eye's name is Alastor Moody, and now he is hidden in the chest!

In the code below, there is a function openChest, which should assign a real name to the madEye variable. However, this function does not work now. Change code only in this function to make renaming work for the top-level variable madEye.

Write a program in Kotlin
var madEye = "Barty Crouch"
// change only the code of the openChest() function
fun openChest() {
val madEye = "Alastor Moody"
}
___

Create a free account to access the full topic