Skip to content
Quiz · Structs · lesson 3 of 9

Quiz — mutating

Question 1 of 2

What happens when this program is compiled and run?

SWIFT
struct Counter {
    var count = 0

    mutating func increment() {
        count += 1
    }
}

let c = Counter()
c.increment()
print(c.count)