mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-05 21:18:11 +08:00
14 lines
318 B
Rust
14 lines
318 B
Rust
|
fn main() {
|
||
|
// ANCHOR: here
|
||
|
use std::collections::HashMap;
|
||
|
|
||
|
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);
|
||
|
// ANCHOR_END: here
|
||
|
}
|