RosettaCodeData/Task/Guess-the-number/Lua/guess-the-number.lua
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

14 lines
261 B
Lua

math.randomseed( os.time() )
n = math.random( 1, 10 )
print( "I'm thinking of a number between 1 and 10. Try to guess it: " )
repeat
x = tonumber( io.read() )
if x == n then
print "Well guessed!"
else
print "Guess again: "
end
until x == n