From e9dc52c2d3abb60c532634ffbda7f435b4c3d140 Mon Sep 17 00:00:00 2001 From: seporterfield <107010978+seporterfield@users.noreply.github.com> Date: Sun, 1 Jan 2023 01:58:57 +0100 Subject: moved iterator exercises --- exercises/iterators/iterators1.rs | 24 ++++++++++++++++++++++++ exercises/standard_library_types/iterators1.rs | 24 ------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 exercises/iterators/iterators1.rs delete mode 100644 exercises/standard_library_types/iterators1.rs (limited to 'exercises') diff --git a/exercises/iterators/iterators1.rs b/exercises/iterators/iterators1.rs new file mode 100644 index 0000000..0379c6b --- /dev/null +++ b/exercises/iterators/iterators1.rs @@ -0,0 +1,24 @@ +// iterators1.rs +// +// Make me compile by filling in the `???`s +// +// When performing operations on elements within a collection, iterators are essential. +// This module helps you get familiar with the structure of using an iterator and +// how to go through elements within an iterable collection. +// +// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a hint. + +// I AM NOT DONE + +fn main () { + let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"]; + + let mut my_iterable_fav_fruits = ???; // TODO: Step 1 + + assert_eq!(my_iterable_fav_fruits.next(), Some(&"banana")); + assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 2 + assert_eq!(my_iterable_fav_fruits.next(), Some(&"avocado")); + assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 3 + assert_eq!(my_iterable_fav_fruits.next(), Some(&"raspberry")); + assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 4 +} diff --git a/exercises/standard_library_types/iterators1.rs b/exercises/standard_library_types/iterators1.rs deleted file mode 100644 index 0379c6b..0000000 --- a/exercises/standard_library_types/iterators1.rs +++ /dev/null @@ -1,24 +0,0 @@ -// iterators1.rs -// -// Make me compile by filling in the `???`s -// -// When performing operations on elements within a collection, iterators are essential. -// This module helps you get familiar with the structure of using an iterator and -// how to go through elements within an iterable collection. -// -// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a hint. - -// I AM NOT DONE - -fn main () { - let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"]; - - let mut my_iterable_fav_fruits = ???; // TODO: Step 1 - - assert_eq!(my_iterable_fav_fruits.next(), Some(&"banana")); - assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 2 - assert_eq!(my_iterable_fav_fruits.next(), Some(&"avocado")); - assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 3 - assert_eq!(my_iterable_fav_fruits.next(), Some(&"raspberry")); - assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 4 -} -- cgit v1.2.3