K
K
Konstantin Zhikhor2021-10-20 13:28:27
Swift
Konstantin Zhikhor, 2021-10-20 13:28:27

What does the question mark mean in a class?

Hello. Can you please tell me what the question mark means?
Class

class Person {
    var name: String
    init(name: String) {
        self.name = name
    }
    var apartment: Apartment?
    deinit {
        print("\(name) deinit")
    }
}

Why is there a question mark at the end of this line?
var apartment: Apartment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
briahas, 2021-10-20
@shevchenko__k

Will this help or is it better in Russian? - https://developer.apple.com/documentation/swift/op...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question