Page 205


var div: Int { return self / 5 } }

let addition = 3.add println("Addition is \(addition)")

let subtraction = 120.sub println("Subtraction is \(subtraction)")

let multiplication = 39.mul println("Multiplication is \(multiplication)")

let division = 55.div println("Division is \(division)")

let mix = 30.add + 34.sub println("Mixed Type is \(mix)") When we run the above program using playground, we get the following result: Addition is 103 Subtraction is 110 Multiplication is 390 Division is 11 Mixed Type is 154

Initializers Swift provides the flexibility to add new initializers to an existing type by extensions. The user can add their own custom types to extend the types already defined and additional initialization options are also possible. Extensions supports only init(). deinit() is not supported by the extensions. struct sum { var num1 = 100, num2 = 200 }

struct diff { var no1 = 200, no2 = 100 193

​Quick is a effective and user-friendly coding language for macOS, iOS, watchOS and tvOS....