小编use*_*382的帖子

使用if,elifif和else在Lua中重复直到循环

我是Lua的新手,我对这段代码有疑问。据推测,以验证用户输入与io.read再运行正确ifelseifelse声明。用户输入正确的响应后,代码应结束。由于某种原因,代码将仅运行初始if语句。任何帮助将不胜感激。

repeat
    resp1 = io.read()

    if resp1 == "Yes" or "yes" then
        print("Well alright then, come on in.")
        print("Let me just take your blood sample like all the rest and you'll be good to go.")
    elseif resp1 == "No" or "no" then
        print("Oh, your not? Then why are you up here?")
        print("Oh nevermind then. None of my business anyways. All I'm supposed to do is take a blood sample for …
Run Code Online (Sandbox Code Playgroud)

lua string-comparison

2
推荐指数
1
解决办法
1086
查看次数

标签 统计

lua ×1

string-comparison ×1