1
0
dust/examples/guessing_game.ds
2024-12-11 01:22:40 -05:00

20 lines
340 B
Plaintext

write_line("Guess the number.")
let secret_number = random(0..100)
loop {
write_line("Input your guess.")
let input = io.read_line()
let guess = int.parse(input)
if guess < secret_number {
io.write_line("Too low!")
} else if guess > secret_number {
io.write_line("Too high!")
} else {
io.write_line("You win!")
break
}
}