mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-05 09:43:31 +02:00
progress(modules + hashmaps): finished modules and almost done hashmaps
This commit is contained in:
@@ -9,10 +9,11 @@ use std::collections::HashMap;
|
||||
fn fruit_basket() -> HashMap<String, u32> {
|
||||
// TODO: Declare the hash map.
|
||||
// let mut basket =
|
||||
|
||||
let mut basket = HashMap::new();
|
||||
// Two bananas are already given for you :)
|
||||
basket.insert(String::from("banana"), 2);
|
||||
|
||||
basket.insert(String::from("apple"), 2);
|
||||
basket.insert(String::from("mango"), 1);
|
||||
// TODO: Put more fruits in your basket.
|
||||
|
||||
basket
|
||||
|
||||
@@ -28,10 +28,12 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
|
||||
Fruit::Pineapple,
|
||||
];
|
||||
|
||||
for fruit in fruit_kinds {
|
||||
for _fruit in fruit_kinds {
|
||||
// TODO: Insert new fruits if they are not already present in the
|
||||
// basket. Note that you are not allowed to put any type of fruit that's
|
||||
// already present!
|
||||
basket.insert(Fruit::Banana, 4);
|
||||
basket.insert(Fruit::Pineapple, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user