Update Examples

Glen Whitney 2024-08-27 05:00:41 +00:00
parent 7a2dc713ca
commit d50a721e34

@ -1192,7 +1192,7 @@ fn main
vec2 = vec![4, 5, 6]
//! Note use of fragment of loop construct to just get the corresponding iterator
println! "2 in vec1: {}", &in vec1.any *$ == 2 //! since iterator ...
println! "2 in vec1: {}", in &vec1.any *$ == 2 //! since iterator ...
//! ... returns references, we have to dereference the argument.
//! Alternatively , we could write `$ == &2`
@ -1205,7 +1205,7 @@ fn main
let array1 = [1, 2, 3]
array2 = [4, 5, 6]
println! "2 in array1: {}", &in array1.any $ == &2
println! "2 in array1: {}", in &array1.any $ == &2
println! "2 in array2: {}", in array2.any $ == 2
```
</td></tr></table>
@ -1259,7 +1259,7 @@ fn main
let vec1 = vec![1, 2, 3]
let vec2 = vec![4, 5, 6]
let mut iter = &in vec1
let mut iter = in &vec1
let mut into_iter = in vec2
println! "Find 2 in vec1: {:?}", iter .find *$ == &2
@ -1268,7 +1268,7 @@ fn main
let array1 = [1, 2, 3];
let array2 = [4, 5, 6];
println! "Find 2 in array1: {:?}", &in array1.find *$ == &2
println! "Find 2 in array1: {:?}", in &array1.find *$ == &2
println! "Find 2 in array2: {:?}", in array2.find *$ == 2
```
</td></tr></table>
@ -1316,7 +1316,9 @@ fn main() {
</td><td>
```
// The below will actually make a closure that captures nothing, not a function as on the left; do we care?
// The below will actually make a closure
// that captures nothing, not a function
// as on the left; do we care?
let is_odd = $ % 2 == 1
fn main