Skip to content

Commit

Permalink
Update vec.md
Browse files Browse the repository at this point in the history
Without `mut` before the `collected_iterator` variable the compiler throws an error when the program is ran.
  • Loading branch information
torressam333 authored Nov 26, 2024
1 parent e1d1f2c commit d0f45cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/std/vec.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ needs to be surpassed, the vector is reallocated with a larger capacity.
```rust,editable,ignore,mdbook-runnable
fn main() {
// Iterators can be collected into vectors
let collected_iterator: Vec<i32> = (0..10).collect();
let mut collected_iterator: Vec<i32> = (0..10).collect();
println!("Collected (0..10) into: {:?}", collected_iterator);
// The `vec!` macro can be used to initialize a vector
Expand Down

0 comments on commit d0f45cb

Please sign in to comment.