init(radiusname: String) { self.radiusname = radiusname }
}
class circumference {
var circumName: String?
var circumNumber: String?
var circumarea: String?
func buildingIdentifier() -> String? {
if circumName != nil {
return circumName
} else if circumNumber != nil {
return circumNumber
} else {
return nil
}
}
}
let circname = rectangle()
if let radiusName = circname.print?[0].radiusname {
println("The first room name is \(radiusName).")
} else {
println("Radius is not specified.")
}
When we run the above program using playground, we get the following result:
Radius is not specified.
In the above program the instance values for the membership function 'radiusName' is not
specified. Hence program call to the function will return only else part whereas to return
the values we have to define the values for the particular membership function.
Program 2
class rectangle {
var print: circle?