lundi 30 mars 2015

How to convert switch statement to if else statement

a and b are both int variables.



switch (a) {
case 0: b ++; break;
case 1:
case -2: b *= 2; break;
case 4: b = 10 * a;
default: b *= a;
}


How would I write this as a if else statement in as simple of a manner as possible?


Aucun commentaire:

Enregistrer un commentaire