What’s the difference between var and let? Which one would you choose for properties in a struct and Class why?
Let is an immutable variable, meaning that it cannot be changed, other languages call this a constant. Var is a mutable variable, meaning that it can be changed. “Use let to make a constant and var to make a variable” let aPerson = Person (name: Foo , first: Bar ) //< data of aPerson are changeable, not the reference var aPerson = Person (name: Foo , first: Bar ) //< both reference and data are changeable. var aPersonA = Person (name: A , first: a) var aPersonB = Person (name: B , first: b) aPersonA = aPersonB //aPersonA now refers to Person (name: B , first: b) Value and Reference Type Reference Type(Class) Swift's classes are mutable a-priory var + class It can be reassigned or changed let + class = constant of address It can not be reassigned and can be changed Value(Struct, Enum) Swift's struct can change th...