我是一名新程序员,目前正在按照教程进行工作。我一直在尝试让用户输入我的代码,我在网上找到的每个示例似乎都表明这是正确的语法。显然我做错了什么:) Xcode 报告:“使用未解析的标识符'输入'”在此先感谢。
import Foundation
var diceRoll = Int(arc4random_uniform(100) + 1)
print("\(diceRoll)")
print("Enter a number between 1 and 100.")
var userinput=input()
let intinput=userinput.toint()
if intinput == diceRoll {print("correct guess")}
if intinput < diceRoll {print("too low")}
else if intinput > diceRoll {print("too high")}