-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4853ee
commit 9642f5a
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` for hints :D | ||
|
||
// 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 2.1 | ||
assert_eq!(my_iterable_fav_fruits.next(), Some(&"raspberry")); | ||
assert_eq!(my_iterable_fav_fruits.next(), ???); // TODO: Step 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters