← Back to archive

Stdle #36 · closures · 2026-07-12

What does this Rust snippet output?

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

fn main() {
let mut c = 0;
let mut bump = || { c += 2; };
bump();
bump();
bump();
println!("{}", c);
}
Closures
4 attempts left

Answer & explanation