Skip to content

Commit 11d4939

Browse files
committed
update
1 parent 7681b62 commit 11d4939

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
fn main() {
2+
let mut vec = vec!["Java", "Rust", "Python"];
3+
for str in vec.iter_mut() {
4+
let &mut cs = str;
5+
match cs {
6+
"Rust" => {
7+
*str = "Niubility";
8+
println!("{}", str);
9+
},
10+
_ => println!("{}", str),
11+
}
12+
}
13+
14+
println!("{:?}", vec);
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
fn main() {
2+
let mut vec = vec!["Java".to_string(), "Rust".to_string(), "Python".to_string()];
3+
let mut vi = vec.iter_mut();
4+
5+
while let Some(cs) = vi.next() {
6+
match cs.as_str() {
7+
"Rust" => {
8+
*cs = "Niubility".to_string();
9+
println!("{}", cs);
10+
},
11+
_ => println!("{}", cs),
12+
}
13+
}
14+
15+
println!("{:?}", vec);
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fn main() {
2+
let mut vec = ["Java".to_string(), "Rust".to_string(), "Python".to_string()];
3+
for mut str in vec.iter_mut() {
4+
match str.as_str() {
5+
"Rust" => {
6+
*str = "Niubility".to_string();
7+
println!("{}", str);
8+
},
9+
_ => println!("{}", str),
10+
}
11+
}
12+
13+
println!("{:?}", vec);
14+
}

0 commit comments

Comments
 (0)