【发布时间】:2015-08-02 20:26:09
【问题描述】:
正在学习游戏应用程序的教程,有一行代码我不明白,它看起来像是元组类型
这是我的代码:
var algorithmResult = algorithm(value: value)
func rowCheck(#value: Int) -> (location: String, pattern: String)? {
var acceptableFinds = ["011", "101", "110"]
var findFunc = [checkTop, checkBottom, checkMiddleAcross, checkRight, checkMiddleDown, checkLeft, checkDiagLeftRight, checkDiagRightLeft]
for algorithm in findFunc {
var algorithmResult = algorithm(value: value)
if (find(acceptableFinds, algorithmResult.pattern) != nil) {
return algorithmResult
}
}
return nil
}
【问题讨论】:
标签: ios iphone swift for-loop tuples