Skip to content

Instantly share code, notes, and snippets.

@fatihgokce
Forked from rust-play/playground.rs
Created May 1, 2019 21:29
Show Gist options
  • Save fatihgokce/48d6664b19d320d3082bd0aa6a816a97 to your computer and use it in GitHub Desktop.
Save fatihgokce/48d6664b19d320d3082bd0aa6a816a97 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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