diff options
| author | Hunter Kvalevog <hunter@kvog.sh> | 2026-10-02 21:53:51 -0500 |
|---|---|---|
| committer | Hunter Kvalevog <hunter@kvog.sh> | 2026-10-02 21:53:51 -0500 |
| commit | 4dfc11d74ab02ac5765ae5d08fb750c91f4744b4 (patch) | |
| tree | 17ba62056d6b691dd0217b0e8f1b3a5826dce0f6 /rustlings/solutions/18_iterators/iterators1.rs | |
| parent | 02d8f1c62896576e1266553a56980eddbc2a88d7 (diff) | |
rustlings: move to rust/
Diffstat (limited to 'rustlings/solutions/18_iterators/iterators1.rs')
| -rw-r--r-- | rustlings/solutions/18_iterators/iterators1.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/rustlings/solutions/18_iterators/iterators1.rs b/rustlings/solutions/18_iterators/iterators1.rs deleted file mode 100644 index 93a6008..0000000 --- a/rustlings/solutions/18_iterators/iterators1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -fn main() { - // You can optionally experiment here. -} - -#[cfg(test)] -mod tests { - #[test] - fn iterators() { - let my_fav_fruits = ["banana", "custard apple", "avocado", "peach", "raspberry"]; - - // Create an iterator over the array. - let mut fav_fruits_iterator = my_fav_fruits.iter(); - - assert_eq!(fav_fruits_iterator.next(), Some(&"banana")); - assert_eq!(fav_fruits_iterator.next(), Some(&"custard apple")); - assert_eq!(fav_fruits_iterator.next(), Some(&"avocado")); - assert_eq!(fav_fruits_iterator.next(), Some(&"peach")); - assert_eq!(fav_fruits_iterator.next(), Some(&"raspberry")); - assert_eq!(fav_fruits_iterator.next(), None); - // ^^^^ reached the end - } -} |