Exit game after correct guess
This commit is contained in:
parent
cab74a2477
commit
f7cbc03210
1 changed files with 4 additions and 1 deletions
|
@ -22,7 +22,10 @@ fn main() {
|
||||||
match guess.cmp(&secret_number) {
|
match guess.cmp(&secret_number) {
|
||||||
Ordering::Less => println!("Too small!"),
|
Ordering::Less => println!("Too small!"),
|
||||||
Ordering::Greater => println!("Too big!"),
|
Ordering::Greater => println!("Too big!"),
|
||||||
Ordering::Equal => println!("You win!"),
|
Ordering::Equal => {
|
||||||
|
println!("You win!");
|
||||||
|
break;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue