Tuples for grouped values
📖 Scenario: You are organizing a small fruit shop's inventory. Each fruit has a name and a price per kilogram. You want to group these two pieces of information together for easy handling.
🎯 Goal: Build a Swift program that uses tuples to group fruit names with their prices, then access and display this grouped information.
📋 What You'll Learn
Create a tuple with a fruit name and its price
Create a second tuple with another fruit name and price
Access tuple elements by name
Print the fruit name and price in a friendly message
💡 Why This Matters
🌍 Real World
Grouping related data like fruit name and price helps organize inventory information clearly and accessibly.
💼 Career
Understanding tuples is useful for developers to group small sets of related data without creating full custom types.
Progress0 / 4 steps