Update Examples
parent
7f8bfc07d1
commit
5b67dd529b
@ -926,7 +926,7 @@ fn main() {
|
|||||||
|
|
||||||
for name in names.iter() {
|
for name in names.iter() {
|
||||||
match name {
|
match name {
|
||||||
&"Ferris" => println!("There is a rustacean among us!"),
|
&"Ferris" => println!("Rustacean alert!"),
|
||||||
_ => println!("Hello {}", name),
|
_ => println!("Hello {}", name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ fn main() {
|
|||||||
|
|
||||||
for name in names.iter_mut() {
|
for name in names.iter_mut() {
|
||||||
*name = match name {
|
*name = match name {
|
||||||
&mut "Ferris" => "There is a rustacean among us!",
|
&mut "Ferris" => "Rustacean alert!",
|
||||||
_ => "Hello",
|
_ => "Hello",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -960,7 +960,7 @@ fn main
|
|||||||
|
|
||||||
for name from names
|
for name from names
|
||||||
match name
|
match name
|
||||||
&"Ferris" => println! "There is a rustacean among us!"
|
&"Ferris" => println! "Rustacean alert!"
|
||||||
_ => println! "Hello {}", name
|
_ => println! "Hello {}", name
|
||||||
|
|
||||||
println!("names: {:?}", names);
|
println!("names: {:?}", names);
|
||||||
@ -969,7 +969,7 @@ fn main
|
|||||||
|
|
||||||
for name on names
|
for name on names
|
||||||
*name = match name
|
*name = match name
|
||||||
&mut "Ferris" => "There is a rustacean among us!"
|
&mut "Ferris" => "Rustacean alert!"
|
||||||
_ => "Hello"
|
_ => "Hello"
|
||||||
|
|
||||||
println!("names: {:?}", names);
|
println!("names: {:?}", names);
|
||||||
@ -985,6 +985,5 @@ fn main
|
|||||||
// println!("names: {:?}", names); // compile error
|
// println!("names: {:?}", names); // compile error
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
</td></tr></table>
|
</td></tr></table>
|
Loading…
Reference in New Issue
Block a user