1
0

Clean up examples

This commit is contained in:
Jeff 2024-02-19 21:17:28 -05:00
parent 900de8ca4b
commit 25e3941315
2 changed files with 6 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -4,22 +4,22 @@
output("Guess the number.") output("Guess the number.")
secret_number = int:random_range(0..=100); secret_number = int:random_range(0..=100)
loop { loop {
output("Please input your guess.") output("Please input your guess.")
input = io:stdin():expect("Failed to read line.") input = io:stdin():expect("Failed to read line.")
guess = int:parse(input); guess = int:parse(input)
output("You guessed: " + guess) output("You guessed: " + guess)
match cmp(guess, secret_number) { match cmp(guess, secret_number) {
Ordering::Less -> output("Too small!"), Ordering::Less -> output("Too small!")
Ordering::Greater -> output("Too big!"), Ordering::Greater -> output("Too big!")
Ordering::Equal -> { Ordering::Equal -> {
output("You win!"); output("You win!")
break; break
} }
} }
} }