Update Examples

Glen Whitney 2024-08-25 17:53:04 +00:00
parent 7f8bfc07d1
commit 5b67dd529b

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