我一直在爲Swift編寫一些教程。我遇到了一個TicTacToe教程,我嘗試使用Xcode 6 Beta 6進行編碼。當我檢查字典中的值時,出現以下錯誤:無法找到接受所提供參數的'& &'的過載。這是我的代碼。Swift錯誤:無法找到接受提供參數的'&&'的重載
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!"
}
如何將某些東西分解爲子表達式? – skyguy 2014-09-20 16:14:09