ImTaken

GuessANumber

Aug 23rd, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. term.clear()
  2. textutils.slowPrint("Guess the Number")
  3. print("You have 6 guesses. Guess the number before you run out of guesses.")
  4. numb = math.random(1, 100)
  5. while true do
  6.     guess = io.read()
  7.     guess = tonumber(guess)
  8.     if guess == numb then
  9.         win = true
  10.         break
  11.     else
  12.         print("Incorrect!")
  13.         if guess > numb then
  14.             print("Your guess was too high.")
  15.         elseif guess < numb then
  16.             print("Your guess was too low.")
  17.         else
  18.             print("I have no idea what happened.")
  19.         end
  20.         tries = tries + 1
  21.     end
  22. end
Add Comment
Please, Sign In to add comment