0
Only number can be write in case?
3 Respuestas
+ 3
String and Enum can also be used as evaluation subject for `switch`. For the next time, please try to search the forum for possible similar thread topics. It helps in reducing duplicate questions 👍
https://www.csharp-examples.net/switch
(Edit)
I didn't see there was already answers when posting, refresh the page then I see 😆
+ 3
Chars too are accepted.
char c = 'a';
switch(c){
case 'a':
Console.WriteLine("hi");
break;
}