← Back to archive

Stdle #118 · comparisons · 2026-10-02

What does this Rust snippet output?

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

fn main() {
let arr = [1, 2, 3, 4, 5];
let s = match arr {
[first, .., last] => format!("{}..{}", first, last),
};
println!("{}", s);
}
Comparisons
4 attempts left

Answer & explanation