Created
May 1, 2019 21:27
-
-
Save rust-play/fafcb77d713708f7187ca780886eb133 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let names = vec!["Bob", "Frank", "Ferris"]; | |
for name in names.iter() { | |
match name { | |
&"Ferris" => println!("There is a rustacean among us!"), | |
_ => println!("Hello {}", name), | |
} | |
} | |
let mut names2 = vec!["Bob", "Frank", "Ferris"]; | |
for name in names2.iter_mut() { | |
match name { | |
&mut "Ferris" => println!("There is a rustacean among us!"), | |
_ => println!("Hello {}", name), | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment