​Fast is just a powerful and instinctive programming language for macOS, iOS, watchOS and tvOS...

Page 209

Swift

var no1 = 1 while multtable > 0 { no1 *= 10 --multtable } return (self / no1) % 10 } }

println(12[0]) println(7869[1]) println(786543[2]) When we run the above program using playground, we get the following result: 2 6 5

Nested Types Nested types for class, structure and enumeration instances can also be extended with the help of extensions. extension Int { enum calc { case add case sub case mult case div case anything }

var print: calc { switch self { case 0: 197


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.