Using CONTINUE in a SWITCH

1

What I want is for the program to go back to execute a switch if it goes into the default option, it could be done using a loop but the thing is to avoid using them. Here I leave my example:

error:
    switch(empezar){
        case "start": System.out.println("En breves comenzaras, recuerda que tu puntuacion inicial es 0 y deberas llegar como minimo a 5 para pasar este test.");
            break;
        case "cancelar":System.out.println("Vuelve cuando estes preparado."); System.exit(0);
            break;
        case "salir": System.out.println("Gracias por jugar.");System.exit(0);
            break;
        default: System.out.println("No es un comando valido.");
            continue error;
    }
    
asked by Partyhard 14.10.2018 в 17:56
source

1 answer

0

It is not possible to use break; or continue; outside of a loop.

    
answered by 30.10.2018 / 16:13
source