Add exercise for creating references in patterns

This commit is contained in:
lukabavdaz
2018-10-31 04:01:42 +01:00
parent af8550f68c
commit a1668451e1
3 changed files with 49 additions and 0 deletions

47
ex6.rs Normal file
View File

@@ -0,0 +1,47 @@
// ex6.rs
// Make me compile! Scroll down for hints :)
fn main() {
let robot_name = Some(String::from("Bors"));
match robot_name {
Some(name) => println!("Found a name: {}", name),
None => (),
}
println!("robot_name is: {:?}", robot_name);
}
// Hint: The following two statements are equivalent:
// let x = &y;
// let ref x = y;