From 0ebe26c8ea87e650a4f440b4875b338bf0a34f1c Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Sun, 25 Aug 2024 17:55:45 +0000 Subject: [PATCH] Update Examples --- Examples.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Examples.md b/Examples.md index 30a634d..6f47cfc 100644 --- a/Examples.md +++ b/Examples.md @@ -910,7 +910,7 @@ fn main #### for loops -This subsection introduces the three ways of converting collections into iterators. For convenience, we combine them into a single example here. Note that Husht will provide three different prepositions for looping as syntactic sugar for the three methods of obtaining an iterator from the collection. The proposal below uses `in` as Rust does, `from` for borrowing, and `on` for borrowing mutably. We should also consider `in`, `&in`, and `&mut in`, as that might be more Rust-y. +This subsection introduces the three ways of converting collections into iterators. For convenience, we combine them into a single example here. Note that in Husht you can select the mode of conversion by decorating the looping preposition `in`. @@ -958,7 +958,7 @@ fn main() { fn main let mut names = vec!["Bob", "Frank", "Ferris"] - for name from names + for name &in names match name &"Ferris" => println! "Rustacean alert!" _ => println! "Hello {}", name @@ -967,7 +967,7 @@ fn main - for name on names + for name &mut in names *name = match name &mut "Ferris" => "Rustacean alert!" _ => "Hello"