diff --git a/src/flow_control/for.md b/src/flow_control/for.md index 4205b002c4..a24228e8f2 100644 --- a/src/flow_control/for.md +++ b/src/flow_control/for.md @@ -99,11 +99,13 @@ fn main() { let mut names = vec!["Bob", "Frank", "Ferris"]; for name in names.iter_mut() { - match name { - &mut "Ferris" => println!("There is a rustacean among us!"), - _ => println!("Hello {}", name), + *name = match name { + &mut "Ferris" => "There is a rustacean among us!", + _ => "Hello", } } + + println!("names: {:?}", names); } ```