We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1cce073 + 9b02990 commit 7b47865Copy full SHA for 7b47865
src/flow_control/match/guard.md
@@ -18,6 +18,22 @@ fn main() {
18
}
19
```
20
21
+Note that the compiler does not check arbitrary expressions for whether all
22
+possible conditions have been checked. Therefore, you must use the `_` pattern
23
+at the end.
24
+
25
+```rust,editable
26
+fn main() {
27
+ let number: u8 = 4;
28
29
+ match number {
30
+ i if i == 0 => println!("Zero"),
31
+ i if i > 0 => println!("Greater than zero"),
32
+ _ => println!("Fell through"), // This should not be possible to reach
33
+ }
34
+}
35
+```
36
37
### See also:
38
39
[Tuples](../../primitives/tuples.md)
0 commit comments