0

您好,我一直在尝试使此代码正常工作,我什至作弊并将目标添加到我的代码中,但它仍然不接受我的答案,有什么建议吗?

-- Functions...
function p() -- For user imput..
        print("Enter # and try to get the closest to it! (Valid range is 1-100)")
        local var = tonumber(io.read())
        if var == nil then
            var = 0
        end
return var
end
--Start main code..


-- Initialize the pseudo random number generator (I'm on windows...)
math.randomseed( os.time() )
math.random(); math.random(); math.random()
-- Setting goal
goal = math.random(1,100)
-- Guessing loop...
repeat
        g = p()
        print(g)
        print(goal)
until g == Goal
print("YOU GUESSED THE GOAL!")
4

1 回答 1

4

将 G 替换为小写 g。

until g == goal
于 2012-09-29T17:08:04.907 回答