mirror of https://github.com/rust-lang/book
Compare commits
2 Commits
c3021dba36
...
f75b96994d
Author | SHA1 | Date |
---|---|---|
Veera | f75b96994d | |
Veera | e4e9ba7866 |
|
@ -10,11 +10,11 @@ a_value` because if the value in the `a_value` variable is `None` rather than
|
|||
|
||||
Function parameters, `let` statements, and `for` loops can only accept
|
||||
irrefutable patterns, because the program cannot do anything meaningful when
|
||||
values don’t match. The `if let` and `while let` expressions accept
|
||||
refutable and irrefutable patterns, but the compiler warns against
|
||||
irrefutable patterns because by definition they’re intended to handle possible
|
||||
failure: the functionality of a conditional is in its ability to perform
|
||||
differently depending on success or failure.
|
||||
values don’t match. The `if let` and `while let` expressions and the
|
||||
`let`-`else` statement accept refutable and irrefutable patterns, but the
|
||||
compiler warns against irrefutable patterns because by definition they’re intended
|
||||
to handle possible failure: the functionality of a conditional is in its ability
|
||||
to perform differently depending on success or failure.
|
||||
|
||||
In general, you shouldn’t have to worry about the distinction between refutable
|
||||
and irrefutable patterns; however, you do need to be familiar with the concept
|
||||
|
|
Loading…
Reference in New Issue