1
0
dust/examples/guessing_game.ds
2024-08-20 15:55:35 -04:00

20 lines
343 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
}
}