gpt4 book ai didi

swift - 我想要一个常量的绝对值,常量类型是CLLocationDegrees

转载 作者:行者123 更新时间:2023-11-30 14:08:24 25 4
gpt4 key购买 nike

我不知道如何解决这个问题,我在晶圆厂上遇到错误:一行中的连续语句必须用 ';' 分隔

 func isUpdateLocation(currentLocation: CLLocationCoordinate2D, userLocation: CLLocationCoordinate2D)-> Bool {

let latitude: CLLocationDegrees = currentLocation.latitude - userLocation.latitude
let longitude: CLLocationDegrees = currentLocation.longitude - userLocation.longitude

let absoluteValueOfLatitude = fabs(latitude)// the fabs I get the error :Consecutive statements on a line must be separated by ';'
let absoluteValueOfLongitude = fabs(longitude)

if latitude > 0.01 || longitude > 0.01 {

return true
}

return false

}

最佳答案

啊哈,问题是您输入了不同等于运算符。

// odd equal operator
let absoluteValueOfLatitude = fabs(latitude)

// correct equal operator
let absoluteValueOfLatitude = fabs(latitude)

// notice the difference with these two equal operator (= & =)

关于swift - 我想要一个常量的绝对值,常量类型是CLLocationDegrees,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32066045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com