Program Stability Concepts in Go
📖 Scenario: You are building a simple Go program that processes a list of tasks with their durations. You want to make sure the program handles unexpected situations gracefully to stay stable.
🎯 Goal: Build a Go program that creates a map of tasks and durations, sets a maximum allowed duration, filters tasks that exceed this duration, and prints the filtered tasks. This teaches how to keep a program stable by controlling input and output.
📋 What You'll Learn
Create a map called
tasks with exact entries: "Email": 30, "Meeting": 90, "Coding": 120, "Break": 15Create an integer variable called
maxDuration and set it to 60Use a
for loop with variables task and duration to iterate over tasks and create a new map filteredTasks with only tasks having duration less than or equal to maxDurationPrint the
filteredTasks map💡 Why This Matters
🌍 Real World
Filtering tasks by duration helps keep programs stable by avoiding processing tasks that take too long.
💼 Career
Understanding how to filter and control data flow is important for writing reliable and maintainable Go programs in software development.
Progress0 / 4 steps