为什么 continue
标记错误:
continue is only allowed inside a loop
private func addToUnloadedImagesRow(row: Int, forLocation:String!) {
guard unloadedImagesRows[forLocation] != nil else {
unloadedImagesRows[forLocation] = [Int]()
continue
}
unloadedImagesRows[forLocation]!.append(row)
}
我该如何解决?
最佳答案
continue
语句应该用在 loops
中。
如果你想检查多个条件,那么你应该使用 if
语句而不是 guard
。
关于Swift 语言 : how to continue after a guard statement?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36564206/