Skip to content
Quiz · Closures · lesson 8 of 8

Quiz — capturing

Question 1 of 2

What does the program print?

SWIFT
func makeCounter() -> () -> Int {
    var count = 0
    return {
        count += 1
        return count
    }
}

let c1 = makeCounter()
let c2 = c1
print(c1(), c2(), c1())