User function not declared within scope of case function

I am trying to call my own functions within a case function but it comes up with the error that they are not declared within the scope.

The error that comes up flags the first function called so is therefore " ‘zeroPosition’ was not declared in this scope "

Is it possible to call the functions within a case or will I have to resort to another method?

Here is my code:

#include <AccelStepper.h>

#define STEPPER_X_TOP_DIR_PIN 10
#define STEPPER_X_TOP_STEP_PIN 9
#define STEPPER_X_BOTTOM_DIR_PIN 7
#define STEPPER_X_BOTTOM_STEP_PIN 6
#define STEPPER_Y_DIR_PIN 4
#define STEPPER_Y_STEP_PIN 3

#define step4Xtop 8
#define step4Xbot 5
#define step4Y 2

#define buttonPin  12

int buttonState;

int count = 0;


// Define some steppers and the pins the will use
AccelStepper stepperXtop  (AccelStepper::DRIVER, STEPPER_X_TOP_STEP_PIN,    STEPPER_X_TOP_DIR_PIN);
AccelStepper stepperXbot  (AccelStepper::DRIVER, STEPPER_X_BOTTOM_STEP_PIN, STEPPER_X_BOTTOM_DIR_PIN);
AccelStepper stepperY     (AccelStepper::DRIVER, STEPPER_Y_STEP_PIN,        STEPPER_Y_DIR_PIN);

void setup()
{
  pinMode(buttonPin, INPUT);

  pinMode(step4Xtop, OUTPUT);
  pinMode(step4Xbot, OUTPUT);
  pinMode(step4Y   , OUTPUT);
  digitalWrite(step4Xtop, HIGH);
  digitalWrite(step4Xbot, HIGH);
  digitalWrite(step4Y   , HIGH);

  stepperXtop.setMaxSpeed(2000);
  stepperXtop.setAcceleration(1500);

  stepperXbot.setMaxSpeed(2000);
  stepperXbot.setAcceleration(1500);

  stepperY.setMaxSpeed(2000);
  stepperY.setAcceleration(1500);

}

// X-AXIS --- RIGHT IS NEGATIVE (-)
// X-AXIS --- LEFT IS POSITIVE (+)

// Y-AXIS --- UP IS POSITIVE (+)
// Y-AXIS --- DOWN IS NEGATIVE (-)

void loop()
{
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {

    count++;               // add 1 to the count

    if (count > 3) {

      count = 0;

    }
  }
  else {
  }

  
    switch (count) {
      case 1:
        //do something when var equals 1
        zeroPosition();
        initiate();
        break;
      case 2:
        //do something when var equals 2
        startPosition();
        zeroPosition();
        cleanFlatGlass();
        YMoveDown();
        cleanFlatGlass();
        YMoveDown();
        break;
      case 3:
        //do something when var equals 2
        YMoveDown();
        cleanFlatGlass();
        break;
}


float distance (float mm)
{
  float result;

  result = 21.0526 * mm; // distance in millimetres

  return result;
}

void zeroPosition ()
{
  stepperXtop.    setCurrentPosition(0);
  stepperXbot.    setCurrentPosition(0);
  stepperY.       setCurrentPosition(0);
}

void initiate ()
{
  do
  {
    stepperXtop.    moveTo(distance(-590));
    stepperXbot.    moveTo(distance(-590));
    stepperY.       moveTo(distance(272));

    stepperXtop.    run();
    stepperXbot.    run();
    stepperY.       run();
  }
  while ((stepperXtop.distanceToGo() != 0) ||
        (stepperXbot.distanceToGo() != 0) ||
        (stepperY.   distanceToGo() != 0));
}

void startPosition () //this loop will be activated by a button press
{
  do
  {
    stepperXtop.    moveTo(distance(0));
    stepperXbot.    moveTo(distance(0));

    stepperXtop.    run();
    stepperXbot.    run();
  }
  while ((stepperXtop.distanceToGo() != 0) ||
        (stepperXbot.distanceToGo() != 0) ||
        (stepperY.   distanceToGo() != 0));
}

void cleanFlatGlass ()
{
  do
  {
    stepperXtop.    moveTo(distance(-350));
    stepperXbot.    moveTo(distance(-350));

    stepperXtop.    run();
    stepperXbot.    run();
  }
  while ((stepperXtop.distanceToGo() != 0) ||
        (stepperXbot.distanceToGo() != 0) ||
        (stepperY.   distanceToGo() != 0));

  do
  {
    stepperXtop.    moveTo(distance(0));
    stepperXbot.    moveTo(distance(0));

    stepperXtop.    run();
    stepperXbot.    run();
  }
  while ((stepperXtop.distanceToGo() != 0) ||
         (stepperXbot.distanceToGo() != 0) ||
         (stepperY.   distanceToGo() != 0));
}

void YMoveDown ()
{
  do
  {
    stepperY. moveTo(distance(-46));

    stepperY.       run();
  }
  while (stepperY.distanceToGo() != 0);

  stepperY.       setCurrentPosition(0);
}

If it aids the understanding I am creating an automatic cleaner for a fish tank and each function is a set of movements for the stepper motors. I am really hoping that I can call the functions within the cases as it will massively simplify the main body of code.

Thanks,
Will

case function? case is syntax, not a function. You can call any function anywhere its visible (in scope).

You've posted a file that doesn't have balanced paratheses. It doesn't give the error you claim for me.

It looks to me like your button handling is going to need some TLC.
You're going to go from count = 0 and back again in not very long at all.
Have a look at the state change example in the IDE

Try doing an Auto Format (Ctrl-T) and then you might notice that you haven't finished loop() correctly so all your later functions are incorrectly defined.

Steve