diff options
| author | seporterfield <107010978+seporterfield@users.noreply.github.com> | 2023-01-01 01:58:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-01 01:58:57 +0100 |
| commit | e9dc52c2d3abb60c532634ffbda7f435b4c3d140 (patch) | |
| tree | eb7a17aef7a8b281689d48dcff81c7c2fcd1e0e7 /exercises/iterators/iterators1.rs | |
| parent | a0c5a892d3f1a5b4fa1d2bba41fb1dca145460f3 (diff) | |
moved iterator exercises
Diffstat (limited to 'exercises/iterators/iterators1.rs')
| -rw-r--r-- | exercises/iterators/iterators1.rs | 24 |
1 files changed, 24 insertions, 0 deletions
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 +} |
