← Back to archive

Stdle #31 · iteration · 2026-07-07

What does this Rust snippet output?

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

fn main() {
let s = (1..=4)
.fold(0, |acc, x| acc + x);
println!("{}", s);
}
Iteration
4 attempts left

Answer & explanation