+ 1
Does switch take interger values for case ? Like case :1, Case:"one"
3 Answers
+ 6
case 1 : is integer no doubt.
but case "one" : is string.
if its Java then both can be given and the vlaue will be checked with the one in switch statement.
+ 1
Works in C# like this
int myVar = 2;
switch(myVar){
case 1:
Console.WriteLine(1);
break;
case 2:
Console.WriteLine(2);
break;
};
+ 1
thanks