Completed hashmaps

This commit is contained in:
2026-01-09 17:18:22 +01:00
parent 56f173c53b
commit f3b42e5620
7 changed files with 246 additions and 12 deletions

View File

@@ -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 scores1= scores.entry(team_1_name).or_insert(TeamScores { goals_scored: (0), goals_conceded: (0) });
scores1.goals_scored += team_1_score;
scores1.goals_conceded += team_2_score;
let scores2= scores.entry(team_2_name).or_insert(TeamScores { goals_scored: (0), goals_conceded: (0) });
scores2.goals_scored += team_2_score;
scores2.goals_conceded += team_1_score;
}
scores