Page 179

Swift

} }

let rectname = rectangle()

if let rectarea = rectname.print?.cprint { println("Area of rectangle is \(rectarea)") }

else { println("Rectangle Area is not specified")

} When we run the above program using playground, we get the following result: Rectangle Area is not specified

Calling Methods Through Optional Chaining class rectangle { var print: circle? } class circle { var area = [radius]() var cprint: Int { return area.count } subscript(i: Int) -> radius { get { return area[i] } set { area[i] = newValue } }

func circleprint() { println("Area of Circle is: \(cprint)") } 167

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

...

Read more
Read more
Similar to
Popular now
Just for you