summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch08-common-collections/no-listing-03-iterate-over-hashmap/src/main.rs
blob: bb13c86f1d4e81fa38c3887ea7fb8b8e024f88d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn main() {
    // ANCHOR: here
    use std::collections::HashMap;

    let mut scores = HashMap::new();

    scores.insert(String::from("Blue"), 10);
    scores.insert(String::from("Yellow"), 50);

    for (key, value) in &scores {
        println!("{key}: {value}");
    }
    // ANCHOR_END: here
}