Can Switch Case statements be outside the void loop?

The compiler probably doesn't like the solitary XOR operator.