Clean up examples
This commit is contained in:
parent
900de8ca4b
commit
25e3941315
Binary file not shown.
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user