2024-08-20 19:55:35 +00:00
|
|
|
write_line("Guess the number.")
|
2024-03-20 20:15:45 +00:00
|
|
|
|
2024-08-20 19:55:35 +00:00
|
|
|
let secret_number = random(0..100);
|
2024-03-20 20:15:45 +00:00
|
|
|
|
|
|
|
loop {
|
2024-08-20 19:55:35 +00:00
|
|
|
write_line("Input your guess.")
|
2024-03-20 20:15:45 +00:00
|
|
|
|
2024-08-20 19:55:35 +00:00
|
|
|
let input = io.read_line();
|
|
|
|
let 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
|
|
|
|
}
|
|
|
|
}
|