DAY 12

OPTIONALS


Null references – literally when a variable has no value – were invented by Tony Hoare way back in 1965. When asked about it in retrospect, he said “I call it my billion-dollar mistake” because they lead to so many problems.

This is the last day that you’ll be learning the fundamentals of Swift, and it’s devoted exclusively to Swift’s solution to null references, known as optionals. These are a really important language feature, but they can hurt your brain a little – don’t feel bad if you need to repeat some videos a few times.

Today you have 11 one-minute videos to watch, and you’ll meet unwrapping, optional chaining, typecasting, and more. Once you’ve watched each video there’s a short test to help make sure you’ve understood what was taught.

  1. Handling missing datatest
  2. Unwrapping optionalstest
  3. Unwrapping with guardtest
  4. Force unwrappingtest
  5. Implicitly unwrapped optionalstest
  6. Nil coalescingtest
  7. Optional chainingtest
  8. Optional trytest
  9. Failable initializerstest
  10. Typecastingtest
  11. Optionals summarytest

Need help? Tweet me @twostraws!

100 DAYS OF SWIFT


The 100 Days of Swift is a free collection of videos, tutorials, tests, and more to help you learn Swift faster. Click here to learn more, or watch the video below.

Back to 100 Days of Swift

Click here to visit the Hacking with Swift store >>