我一直在为 Swift 编写一些教程。我遇到了一个井字游戏教程,我正在尝试使用 Xcode 6 Beta 6 进行编码。当我检查字典中的值时出现以下错误:找不到接受提供的参数的“&&”的重载。这是我的代码。
var plays = [Int:Int]()
var whoWon = ["I":0,"you":1]
for (key,value) in whoWon {
if ((plays[6] == value && plays[7] == value && plays[8] == value) ||
(plays[3] == value && plays[4] == value && plays[5] == value) ||
(plays[0] == value && plays[1] == value && plays[2] == value) ||
(plays[6] == value && plays[3] == value && plays[0] == value) ||
(plays[7] == value && plays[4] == value && plays[1] == value) ||
(plays[8] == value && plays[5] == value && plays[2] == value) ||
(plays[6] == value && plays[4] == value && plays[2] == value) || // error appears on this line
(plays[8] == value && plays[4] == value && plays[0] == value))
{
userMessage.hidden = false
userMessage.text = "Looks like \(key) won!"
}