How to create tasks?

I have been having some trouble trying to create a task. We are using a catapult this year and we use a limit switch to stop it at the bottom. But in autonomous I have to create a task so that the limit switch is constantly being checked.

You could just do a while(autonomous) {} instead.
-– or —
Another option could be a function with a variable.

bool shot = false;

then in your auton

shot = true;

And then the function itself

void shoot () {
  while (shot) {
     // your code

Your task needs a while loop that doesn’t immediately exit. As soon as your limit switch isn’t pressing, the while loop exits. So make the while loop continue forever.