Introduction
In this challenge, you are developing a task management system for a small team. Your goal is to create a program that categorizes tasks based on their completion status using Go's conditional logic. The task is to implement the sortTask function to categorize tasks into "To Do", "In Progress", and "Completed" lists based on the input task status.
Sort Tasks with Conditional Logic
You are developing a task management system for a small team. Your goal is to create a program that categorizes tasks based on their completion status using Go's conditional logic.
Tasks
- Implement the
sortTaskfunction to categorize tasks using if-else statements - Create different task categories: "To Do", "In Progress", and "Completed"
- Ensure the function returns the correct task list based on the input status
Requirements
- Use the provided
task_sorter.gofile in the~/projectdirectory - Implement the
sortTaskfunction with if-else statements - The function must handle at least three task statuses: "todo", "in_progress", "completed"
- Return the appropriate list name for each status
- Use lowercase status strings for comparison
Examples
Use the following examples to test your implementation:
func main() {
fmt.Println(sortTask("todo"))
fmt.Println(sortTask("in_progress"))
fmt.Println(sortTask("completed"))
}
To run the program, use the command:
go run task_sorter.go
Expected output:
To Do List
In Progress List
Completed List
Hints
- Remember to use lowercase for status comparison
- Pay attention to the exact spelling of status strings
- Use if-else statements to handle different task statuses
Summary
In summary, this challenge requires you to create a program that categorizes tasks based on their completion status using Go's conditional logic. The key tasks are to implement the sortTask function to handle different task statuses, such as "todo", "in_progress", and "completed", and return the appropriate task list name for each status.



