← Back to archive

Stdle #47 · closures · 2026-07-23

What does this Rust snippet output?

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

fn main() {
let mut out = String::new();
let mut add = |s: &str| out.push_str(s);
add("a");
add("bc");
println!("{}", out);
}
Closures
4 attempts left

Answer & explanation