100 Days Challenge to learn the Swift language.
- Variables
- Strings and Integers
- Multiline Strings
- Doubles and Booleans
- String Interpolation
- Constants
- Type Annotations
Source Code : Day 1
- Arrays, sets, tuples, and dictionaries let you store a group of items under a single value. They each do this in different ways, so which you use depends on the behavior you want.
- Arrays store items in the order you add them, and you access them using numerical positions.
- Sets store items without any order, so you can’t access them using numerical positions.
- Tuples are fixed in size, and you can attach names to each of their items. You can read items using numerical positions or using your names.
- Dictionaries store items according to a key, and you can read items using those keys.
- Enums are a way of grouping related values so you can use them without spelling mistakes.
- You can attach raw values to enums so they can be created from integers or strings, or you can add associated values to store additional information about each case.
Source Code : Day 2
- Swift has operators for doing arithmetic and for comparison; they mostly work like you already know.
- There are compound variants of arithmetic operators that modify their variables in place: +=, -=, and so on.
- You can use if, else, and else if to run code based on the result of a condition.
- Swift has a ternary operator that combines a check with true and false code blocks. Although you might see it in other code, I wouldn’t recommend using it yourself.
- If you have multiple conditions using the same value, it’s often clearer to use switch instead.
- You can make ranges using ..< and ... depending on whether the last number should be excluded or included.
Source Code : Day 3