Files
zern/examples/guess_number.zr
2025-07-24 14:06:15 +02:00

14 lines
386 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_line() |> 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!")