Capturing variable

Report a typo

Take a look at this code:

var counter: () -> Int = { -42 }

fun reinitializeCounter(): Int {
    var value = 0
    counter = { ++value }
    return value
}

What does the reinitializeCounter function return if you call it and don't call the counter at the same time?

Select one option from the list
___

Create a free account to access the full topic