add one exercise in patterns.md

This commit is contained in:
sunface
2022-03-11 15:45:03 +08:00
parent 7bc4cf757b
commit 553f7b1648
3 changed files with 43 additions and 0 deletions

View File

@ -85,4 +85,17 @@ fn main() {
}
}
}
```
6.
```rust
fn main() {
let mut v = String::from("hello,");
let r = &mut v;
match r {
// The type of value is &mut String
value => value.push_str(" world!")
}
}
```