Ray Wenderlich Fundamentals Course - Part 3
Yes! Finally some momentum. I'm basically going to continue with the Fundamentals. No more than 45 minutes to help out the old eyes! Start Time - 19:47 More Collections Dictionaries Mostly recap I reckon. Key-value pairs, unordered etc. Interesting - you can't have the same key! Didn't know that to be fair. Not going to put the whole dictionary in but some stuff you can do: for (name, pet) in namesAndPets { print ( " \(name) has a pet called \(pet) " ) } let thorPet = namesAndPets [ "Thor" ] ?? "Nothing for thor" The second one of these is nil coalescing. It's a bit like ternary. These are pretty cool too: for (name, _ ) in namesAndPets { print ( " \(name) has a pet!" ) } for pet in namesAndPets . values { print (pet) } Challenge time! All good! One thing to check was adding a new item - needed to use the syntax NOT with update value. Sets Have ...