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 :