Stephen DeStefano Swift 5 Course - Part 6 (Lectures 23 to 25)
Yes cracking on! Got a bit of time this morning before heading to my Uncle's and Auntie's. I want to cover Optionals then Control Flow. All very doable! Let's go! Start Time - 08:19 Optionals So I know about these but good to go over! They're used in situations where they may not be a value stored. Nil means the absence of a valid object. You can do these for any type at all. Optional types are returned where there may not have been a value e.g. when converting from string number to actual int number. The question mark syntax. Good way of understanding this is that the ? QUESTIONS whether something may not have a value. So the question bit is key there! You can only use nil with optionals. Optionals can only be var as the values are likely to change. If you create an optional without an initial value then it automatically sets this to nil. Forced unwrapping Comparing the optional against nil.... That's not forced unwrapping - that's just ch...