Skip to content

Commit

Permalink
modify iterators starting instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelraz committed Jan 20, 2025
1 parent 7c989ca commit 56c213d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions exercise-book/src/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ five
X
```

- Take the template in [exercise-templates/iterators](../../exercise-templates/iterators/) as a starting point, or use this snippet to get you started:
- Drop this snippet into your `src/main.rs` after you `cargo new iterators`.

```rust
#![allow(unused_imports)]
Expand All @@ -56,8 +56,9 @@ fn main() -> Result<(), Box<dyn Error>> {

```

- Replace the first `todo!` item with [reader.lines()]() and continue "chaining" the iterators until you've calculated the desired result.
- Run the code with `cargo run --bin iterators1` when inside the `exercise-templates` directory
- Place the above multi-line string into `iterators/numbers.txt`.
- Replace the first `todo!` item with [reader.lines()](https://doc.rust-lang.org/stable/std/io/trait.BufRead.html#method.lines) and continue "chaining" the iterators until you've calculated the desired result.
- Run the code with `cargo run --bin iterators1` when inside the `exercise-templates` directory if you want a starting template.

If you need it, we have provided a [complete solution](../../exercise-solutions/iterators/src/bin/iterators1.rs) for this exercise.

Expand Down

0 comments on commit 56c213d

Please sign in to comment.