diff options
Diffstat (limited to 'exercises/18_iterators/iterators1.rs')
| -rw-r--r-- | exercises/18_iterators/iterators1.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/exercises/18_iterators/iterators1.rs b/exercises/18_iterators/iterators1.rs new file mode 100644 index 0000000..31076bb --- /dev/null +++ b/exercises/18_iterators/iterators1.rs @@ -0,0 +1,26 @@ +// iterators1.rs +// +// 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. +// +// Make me compile by filling in the `???`s +// +// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a +// hint. + +// I AM NOT DONE + +#[test] +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 +} |
