Category: Uncategorized

  • Loops How to use a for loop to repeat work Computers are made to do repetitive work. Swift uses loops to do things any number of times or once per item in a dictionary, array, or set. Simple example: Looping over a fixed range. Ex: Nested loops: Ex: Ranges: x…y are inclusive of x and…

    ·

  • Conditions How to check a condition is true or false Basic syntax Braces signal the start and end of a code block. Another example Another example Another example String comparison Example Other ways to check truthiness How to check multiple conditions We want to be able to control the program flow whether something is true…

    ·

  • Complex data types 2 Type annotation – lets us dictate what data type each variable and constant should be Type annotation Sometimes we want to override the default or we want to instantiate without defining the values. Explicit Types When its unnecessary… But it is necessary when creating an empty array Enums Tip Prefer type…

    ·