← Back to archive

Stdle #152 · closures · 2026-11-05

What does this Rust snippet output?

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

fn main() {
let s = String::from("owned");
let f = move || s.len();
println!("{}", f());
println!("{}", f());
}
Closures
2 lines
4 attempts left

Answer & explanation