【发布时间】:2016-05-07 03:37:32
【问题描述】:
我对 Lua 完全陌生,我多次收到此错误“'end' 预期(在第 3 行关闭 'while')靠近 ''” 我已经检查过在线查找答案但没有运气所以我是希望有人能帮我解决这个问题,非常感谢
这是我的代码:
print ("Welcome to the maze")
while input ~= "leave" do
print ("What do you want to do first? Leave or inspect?")
input = io.read()
if input == "inspect" then
print (" You venture towards the maze.")
end
if input == "leave" then
print ("You turn around and run.")
end
【问题讨论】:
-
尝试在 while 循环体的末尾添加一个 'end' 关键字
-
"
" 表示“文件结束”。因此,该消息意味着您的代码在此之前满足所有语法规则。
标签: lua