Top "Switch-statement" questions

In computer programming, a switch, case, select or inspect statement is a type of selection control mechanism used to invoke specific blocks of code based on variable contents.

Replacements for switch statement in Python?

I want to write a function in Python that returns different fixed values based on the value of an input …

python switch-statement
What is the Python equivalent for a case/switch statement?

I'd like to know, is there a Python equivalent for the case statement such as the examples available on VB.…

python switch-statement case-statement
Multiple cases in switch statement

Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: switch (…

c# switch-statement
Why can't I use switch statement on a String?

Is this functionality going to be put into a later Java version? Can someone explain why I can't do this, …

java string switch-statement
Switch statement multiple cases in JavaScript

I need multiple cases in switch statement in JavaScript, Something like: switch (varName) { case "afshin", "saeed", "larry": alert('Hey'); break; …

javascript switch-statement
SQL Switch/Case in 'where' clause

I tried searching around, but I couldn't find anything that would help me out. I'm trying to do this in …

sql switch-statement case
Using two values for one switch case statement

In my code, the program does something depending on the text entered by the user. My code looks like: switch (…

java switch-statement
Why the switch statement cannot be applied on strings?

Compiling the following code and got the error of type illegal. int main() { // Compilation error - switch expression of type …

c++ string switch-statement
Is "else if" faster than "switch() case"?

I'm an ex Pascal guy, currently learning C#. My question is the following: Is the code below faster than making …

c# performance if-statement switch-statement