Can Switch Case statements be outside the void loop?

Hi,

void aFunction(char aValue){
  switch (aValue) {
    case 'A': {
      //Your code
      break;
    }
    case 'B': {
      //Your code
      break;
    }
  }
}


void setup() {

  aFunction('A'); //this will be called once before the loop

}

void loop() {

  aFunction('A'); //this will be called on every loop

}

Jacques