+ 8
String switch
how can we use switch for characters? as the instructions say, switch is only for values, then what about chars?! by the way, don't forget to press the like botton.
2 Réponses
+ 9
char c='M';
switch (c){
case 'A': //stuff
break;
case 'N'://stuff
break;
default : //stuff
}
+ 5
switch can be used with strings too vihuda.
along with byte,short but not long.