Adding and updating values
📖 Scenario: You are managing a small store's inventory. You want to keep track of how many items you have for each product.
🎯 Goal: Create a Go program that stores product quantities in a map, adds a new product, updates the quantity of an existing product, and then shows the final inventory.
📋 What You'll Learn
Create a map called
inventory with initial products and quantitiesAdd a new product with a quantity to the
inventory mapUpdate the quantity of an existing product in the
inventory mapPrint the final
inventory map💡 Why This Matters
🌍 Real World
Stores and businesses often track their inventory using maps or dictionaries to know how many items they have.
💼 Career
Understanding how to add and update values in maps is essential for managing data in many programming jobs, especially in backend development and data processing.
Progress0 / 4 steps