box-o-sand/rustbyexample/flow_control.d/for5.rs

13 lines
273 B
Rust
Raw Normal View History

2023-09-26 15:03:55 +00:00
fn main() {
let mut names = vec!["Bob", "Frank", "Ferris"];
for name in names.iter_mut() {
*name = match name {
&mut "Ferris" => "There is a rustacean among us!",
_ => "Hello",
}
}
println!("names: {:?}", names);
}