On day 2 of 100 days of swift, I learned about arrays, sets, tuples, dictionaries, and enum. It will take some getting use to when it comes to remembering the syntax for tuples and dictionaries. What I really liked about today was that Paul explained when you will need to use each one and the differences between them. For example,
Arrays store items in the way that you write them in your code and you can read the value by using their numerical positions. Technical term for counting form 0 is "zero-based". It is best to use arrays if order matters and you have duplicates.
Sets are in a random order / unordered, the value cannot be read by using numerical positions, and no item can appear twice. It is best to use sets when you want to know if an item exist and you want to find it fast.
Tuples are fixed in size. You cannot remove or add any items and you cannot change the type. You can access items by using numerical positions or by using their names. It is best to use tuples when you have a fixed number of types. For example, you have two strings and thats it.
Dictionaries are interesting. You can use anything to access the values but people commonly use strings. A colon separates the identifier(key) and the value from each other.
Enums are also interesting. They are used as a way to define a group of related values. You can also use an associated value on a case as a way to add additional information about that specific case.
I will revisit this section soon.
Until tomorrow !