Can Switch Case statements be outside the void loop?

Your while is not in a function