mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
add one exercise in patterns.md
This commit is contained in:
@ -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!")
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user