Flow control for
in RBE
This commit is contained in:
12
rustbyexample/flow_control.d/for5.rs
Normal file
12
rustbyexample/flow_control.d/for5.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
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);
|
||||
}
|
Reference in New Issue
Block a user