diff options
| author | Hunter Kvalevog <hunter@kvog.sh> | 2026-09-27 11:08:08 -0500 |
|---|---|---|
| committer | Hunter Kvalevog <hunter@kvog.sh> | 2026-09-27 11:08:08 -0500 |
| commit | b70f498d93fc0e5f94a4465883ad654a63efbb39 (patch) | |
| tree | e7fbb66a21de3e7613d81eb8a592d2709afec81b /rustlings/exercises/11_hashmaps/hashmaps3.rs | |
| parent | 1b413350c46f8214785e179f60693b78a9bb5f2f (diff) | |
| download | demos-b70f498d93fc0e5f94a4465883ad654a63efbb39.tar.gz demos-b70f498d93fc0e5f94a4465883ad654a63efbb39.zip | |
Diffstat (limited to 'rustlings/exercises/11_hashmaps/hashmaps3.rs')
| -rw-r--r-- | rustlings/exercises/11_hashmaps/hashmaps3.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rustlings/exercises/11_hashmaps/hashmaps3.rs b/rustlings/exercises/11_hashmaps/hashmaps3.rs index 5b390ab..0fa4a6b 100644 --- a/rustlings/exercises/11_hashmaps/hashmaps3.rs +++ b/rustlings/exercises/11_hashmaps/hashmaps3.rs @@ -31,6 +31,13 @@ fn build_scores_table(results: &str) -> HashMap<&str, TeamScores> { // Keep in mind that goals scored by team 1 will be the number of goals // conceded by team 2. Similarly, goals scored by team 2 will be the // number of goals conceded by team 1. + let team_1 = scores.entry(team_1_name).or_default(); + team_1.goals_scored += team_1_score; + team_1.goals_conceded += team_2_score; + let team_2 = scores.entry(team_2_name).or_default(); + team_2.goals_scored += team_2_score; + team_2.goals_conceded += team_1_score; + } scores |
