rustbook/ch8/ch10/or_insert.rs
Jasper Ras 10b29ad9cb ch08
2026-01-15 09:09:36 +01:00

11 lines
268 B
Rust

use std::collections::HashMap;
fn main() {
let mut scores = HashMap::new();
scores.insert(String::from("Blue"), 10);
scores.entry(String::from("Yellow")).or_insert(50);
scores.entry(String::from("Blue")).or_insert(50);
println!("{scores:?}");
}