1
0
dust/examples/guessing_game.ds

20 lines
344 B
Plaintext
Raw Normal View History

2024-03-20 20:15:45 +00:00
io.write_line("Guess the number.")
secret_number = int.random_range(0..100)
loop {
io.write_line("Input your guess.")
2024-05-18 15:59:39 +00:00
input = io.read_line()
guess = int.parse(input)
2024-03-20 20:15:45 +00:00
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
}
}