Files
zern/examples/guess_number.zr
2025-07-27 13:16:16 +02:00

14 lines
387 B
Plaintext

func main[] : I64
let answer: I64 = math.abs(math.urandom()) % 100
while true
io.print("Guess a number: ")
let guess: I64 = io.read_stdin() |> str.trim() |> str.parse_i64()
if guess == answer
io.print("You win!")
break
else if guess < answer
io.print("Too low!")
else
io.print("Too high!")