Optionals! What is it good for...

Before we start diving in and look how to use optionals, I think it will be a good start to make clear what problem they solve. I'm sure a lot of people will get mad about the new daily ?-, !-, if let-business just because they don't realize how worse it was in the old Objective-C days.

The old way

Everytime we write a function, declare a property, variable or constant we promise other parts of our code, that it can retrieve a value under this name. But like in the real world we are not always capable of keeping our promises. In the Objective-C days when we promised to return an object-pointer, but weren't able to provide a meaningful value, we returned nil instead. Which was basically a void* pointing to special memory represting a nonexistent object.

nil was kinda great, because