From d50a721e341e1a2aa104351a365dcc9d251e33c3 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Tue, 27 Aug 2024 05:00:41 +0000 Subject: [PATCH] Update Examples --- Examples.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Examples.md b/Examples.md index 60e0eef..50f4718 100644 --- a/Examples.md +++ b/Examples.md @@ -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 ``` @@ -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 ``` @@ -1316,7 +1316,9 @@ fn main() { ``` -// 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