diff options
| author | lukabavdaz <lukabavdaz@gmail.com> | 2018-10-31 04:01:42 +0100 |
|---|---|---|
| committer | lukabavdaz <lukabavdaz@gmail.com> | 2018-10-31 04:01:42 +0100 |
| commit | a1668451e1e6a81b6cd9569e11ab6f56e3c05e2c (patch) | |
| tree | 21e889ac0cc133f9cee509d678192e4256688899 /ex6.rs | |
| parent | af8550f68c483cb422244fbb39a62a41866573d2 (diff) | |
Add exercise for creating references in patterns
Diffstat (limited to 'ex6.rs')
| -rw-r--r-- | ex6.rs | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -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; |
