I am making a hasmap in loop like this
for players in 1..=num{
println!("Enter the name of player # {}",players);
io::stdin()
.read_line(&mut player_name)
.expect("Failed to read line");
scores.insert(&players,player_name.trim().to_string());
player_name=String::from("");
}
Now I want to retrieve the names of each player with respect to their keys and trying to get them by this code
for players in 1..=num{
let secret_number = rand::thread_rng().gen_range(1, 6);
// total += secret_number;
println!("Turn {} Dice Roll of Player {} - {} is {} ",turn,players,
scores.get(&players),secret_number);
}
but the above code is giving error. Please help.