Trick or treating is a lot like optional...

November 2nd, 2020

Trick or treating is a lot like optional...

Trick or treating is a lot like optional handling. Each house may or may not be giving out candy, and until you knock, you won’t know! Much like optionals in code (Java or Swift), where the existence of a value isn’t known until you check, each house may or may not have candy. " "" "Where does the trick come into this analogy, you ask?" "" "When optional unwrapping is not handled correctly, and values are assumed to be present when they are not there, trickery happens! Undefined or unexpected behavior abounds. While there’s an expectation of candy, beware of the tricksters!" "" "Happy Halloween 🎃 #bendevtip


Original post on LinkedIn