Page 190

Swift

} else if circumNumber != nil { return circumNumber } else { return nil } } }

let circname = rectangle() circname.print?[0] = radius(radiusname: "Diameter")

let printing = circle() printing.area.append(radius(radiusname: "Units")) printing.area.append(radius(radiusname: "Meter")) circname.print = printing

if let radiusName = circname.print?[0].radiusname { println("Radius is measured in \(radiusName).") } else { println("Radius is not specified.") } When we run the above program using playground, we get the following result: Radius is measured in Units. In the above program, the instance values for the membership function 'radiusName' is specified. Hence, the program call to the function will now return values.

Chaining on Methods with Optional Return Values Optional chaining is used to access subclasses defined methods too. class rectangle { var print: circle? }

class circle { var area = [radius]() 178

​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