Why can't I to declare public the variable "Clave"?

string Clave = “1234”;

     int[] accesos = { 0, 0, 0 };

    

     switch(Clave)
    {
        case "1234":
            accesos[0]++;
            print("Usuario ha accedido");
            break;

        case "3141":
            accesos[1]++;
            print("Editor ha accedido");
            break;

        case "8007":
            accesos[2]++;
            print("Administrador ha accedido");
            break;

        default:
            print("Acceso denegado");
            break;
    }

Looks to me like the variable is in a method. A variable inside a method can’t be declared public, because it can be used only in the method itself. So you just write it outside of the method (in the class itself) and then declare it as a public variable.