← Back to archive

Stdle #10 · iteration · 2026-06-16

What does this Rust snippet output?

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

fn main() {
let words = ["apple", "fig", "kiwi", "pear"];
let n = words.iter()
.filter(|w| w.len() == 4)
.count();
println!("{}", n);
}
Iteration
4 attempts left

Answer & explanation