所以我开始学习Lua,我的问题是在一个教你创建猜猜我的数字游戏的教程中从这一行开始:
int diff = 0;
int firstNum = temp[0];
int lastNum = temp[0];
for (int j=0; j < temp.length - 1; j++){
if (temp[j] != -1){
diff = Math.abs(temp[j] - temp[j+1]);
if (diff <= 1){
// last number
lastNum = temp[j+1];
}
else {
System.out.println("First number: " + firstNum + ", last number: " + lastNum);
firstNum = temp[j+1];
lastNum = temp[j+1];
}
}
}
所以在教程中显示打印名称但在我的内容中会出现此错误:
name = "John"
print<name>
拜托,我得到了什么?
感谢您的帮助。
答案 0 :(得分:5)
函数使用括号括起它们的参数,因此第二行应该是
print (name)