Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.12 KB

Day3.md

File metadata and controls

30 lines (21 loc) · 1.12 KB

Day 3 - HackingWithSwift - 100DaysOfSwiftUI Challenge

Computers are like old testaments god, lots of rules and no mercy - Joseph Campbell

Operators and Conditions

Today I learnt about:

  • Arithmetic operators
  • Operators overrloading
  • Compound assignment operators
  • Comparison operators
  • Conditions
  • Combining conditions (AND &&, OR ||)
  • The ternary operator
  • Switch statements
  • Range operators

The summary of the entire day was:

  • 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.
  • 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.

That's All for the Day 3 of 100DaysOfSwiftUI!