mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Add new solution in ownership ex. 9
This commit is contained in:
@ -168,3 +168,14 @@ fn main() {
|
|||||||
println!("{:?}, {:?}, {:?}", s1, s2, t); // -> "hello", "world", ("hello", "world")
|
println!("{:?}, {:?}, {:?}", s1, s2, t); // -> "hello", "world", ("hello", "world")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
fn main() {
|
||||||
|
let t = (String::from("hello"), String::from("world"));
|
||||||
|
|
||||||
|
// fill the blanks
|
||||||
|
let (ref s1, ref s2) = t;
|
||||||
|
|
||||||
|
println!("{:?}, {:?}, {:?}", s1, s2, t); // -> "hello", "world", ("hello", "world")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user