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 ca83777 + 6dc57f4 commit d301b3aCopy full SHA for d301b3a
src/flow_control/match.md
@@ -1,7 +1,8 @@
1
# match
2
3
Rust provides pattern matching via the `match` keyword, which can be used like
4
-a C `switch`.
+a C `switch`. The first matching arm is evaluated and all possible values must be
5
+covered.
6
7
```rust,editable
8
fn main() {
@@ -14,10 +15,12 @@ fn main() {
14
15
1 => println!("One!"),
16
// Match several values
17
2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
18
+ // TODO ^ Try adding 13 to the list of prime values
19
// Match an inclusive range
20
13..=19 => println!("A teen"),
21
// Handle the rest of cases
22
_ => println!("Ain't special"),
23
+ // TODO ^ Try commenting out this catch-all arm
24
}
25
26
let boolean = true;
0 commit comments