我正在學習Swift和iOS平臺。我不能讓這個錯誤消失。我已經搜索過,但沒有發現任何基本的東西。幫助表示讚賞。Swift錯誤:使用未解析的標識符
import Foundation
let num1 = 10
let num2 = 5
// declare the function answerResult, which takes and Int
// and returns a string
func answerResult(answer : Int) ->String
if check(num1, num2, answer) {
return "correct!"
}
else {
Return "I'm sorry, that's wrong."
}
}
// Call the function with various numbers
answerResult(15)
answerResult(0)
answerResult(600)
answerResult(5)
Playground execution failed: /var/folders/c8/6w5z3zbx1477cqv1wcys2cd80000gn/T/./lldb/441/playground551 .swift :12:8: error: use of unresolved identifier 'check' if check(num1, num2, answer) {
那麼,你有'check'函數在任何地方聲明? – Vladimir
謝謝,我看到發生了什麼......我想? 我會嘗試從下面的func check()想法。 非常感謝! – scalperjim