Yes it's man vs compiler time and the compiler winning yet again! In the func getRecordNumber I am returning a Bool and a Dictionary
func getRecordNumber(recordNumber: Int32) -> (isGot: Bool, dictLocations: Dictionary <String, Double>)
...
return (isGot, dictLocations)
However after I have called the func and question the Boolean isGot return I get the error message
(isGot: Bool, dictLocations: Dictionary <String, Double>) Does not conform to protocol "Boolean Type"
Any ideas what I have left out?
You don't need to add parameters into return like this (isGot: Bool, dictLocations: Dictionary <String, Double>)
. you just need to tell compiler that what type this function will return.
Here is the correct way to achieve that:
func getRecordNumber(recordNumber: Int32) -> (Bool, Dictionary <String, Double>)
{
let isGot = Bool()
let dictLocations = [String: Double]()
return (isGot, dictLocations)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.