mercredi 1 mai 2019

Can you use multiple values in a switch statement (C#)

I know that using multiple values in a switch case should mean you ought to be using an if-else setup but this is more of a theory question than a practicality.

My question is thus:

switch(x){
    case 4:
        break;
    case 5 || 6:
        break;
}

The above 5 || 6 illustrates the case firing on either x being 5 or 6.

Is this at all possible?

Aucun commentaire:

Enregistrer un commentaire