We've already talked about one method for removing tasks that we don't want running anymore. We can return task.done
to end a task permanently. There are other methods we can use as well, so let's talk about them now.
There may come a time when we need to remove a task from outside the task in question. In this case, task.done
doesn't help us at all. The task manager comes equipped with two methods, called remove
and removeTasksMatching
to help us out with this. Both of these methods operate on task names. remove
requires the exact name of the task we wish to remove, but removeTasksMatching
can use a partial task name with wild cards to remove a group of tasks. Both methods remove all tasks that match the given name, so if multiple tasks have the exact same name either method can remove all of them at once. Here is what the calls look like:
taskMgr.remove("My Task Name") taskMgr.removeTasksMatching("My Task *")