In a switch statement is it possible to use a string variable or can you only use integers (c#) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

In a switch statement is it possible to use a string variable or can you only use integers (c#)

2nd Jun 2017, 8:00 PM
James Murphy
James Murphy - avatar
1 ответ
+ 6
Yes. You can use strings. string a = "a"; switch (a) { case "a": a = "bdhdiw"; break; } Console.Write(a); Output: bdhdiw
2nd Jun 2017, 8:23 PM
Rrestoring faith
Rrestoring faith - avatar