mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-24 08:00:24 +08:00
Fix verbose explanation
This commit is contained in:
parent
e2df7322cd
commit
e4543286a0
@ -637,11 +637,10 @@ match guess.cmp(&secret_number) {
|
||||
|
||||
The `cmp()` method compares two values, and can be called on anything that can
|
||||
be compared. It takes a reference to the thing you want to compare it to, so
|
||||
here it's comparing our `guess` to our `secret_number`. `cmp()` returns a
|
||||
variant of the `Ordering` type we imported with the `use` statement earlier. We
|
||||
use a [`match`][match] statement to decide what to do next based on which
|
||||
variant of `Ordering` we got back from our call to `cmp()` with the values in
|
||||
`guess` and `secret_number`.
|
||||
here it's comparing our `guess` to our `secret_number` and returning a variant
|
||||
of the `Ordering` enum. We use a [`match`][match] statement to decide what to
|
||||
do next based on which variant of `Ordering` we got back from our call to
|
||||
`cmp()` with the values in `guess` and `secret_number`.
|
||||
|
||||
[match]: match.html
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user