All games

Iterator Workshop

Build and trace pipelines that transform, filter, and collect values.

Challenge 1 of 3Score 0 / 3

Arrange the lines to double 1, 2, and 3, then print the vector.

Use the up and down buttons to reorder the lines.

fn main() {
  1. let doubled: Vec<i32> = numbers.map(|n| n * 2).collect();
  2. println!("{doubled:?}");
  3. let numbers = 1..=3;
}
Back to the lesson