← Back to archive

Stdle #54 · iteration · 2026-07-30

What does this Rust snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

fn main() {
let v: Vec<i32> = [1, 2, 8, 3, 1]
.iter()
.skip_while(|&&x| x < 5)
.cloned()
.collect();
println!("{:?}", v);
}
Iteration
4 attempts left

Answer & explanation