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.

Test for multiple cases in a switch, like an OR (||)

How would you use a switch case when you need to test for a or b in the same case? …

javascript switch-statement fall-through
SSRS Conditional Formatting Switch or IIF

I currently have the following 2008 SSRS Report and I want to conditionally format background of the columns based on some …

reporting-services ssrs-2008 switch-statement iif-function
switch() statement usage

I am a little confused about the switch statement in R. Simply googling the function I get an example as …

r switch-statement
How do I use properly CASE..WHEN in MySQL

Here is a demo query, notice it is very simple, Fetches only where base_price is 0, And still, it chooses …

mysql sql conditional switch-statement case
In JavaScript, is returning out of a switch statement considered a better practice than using break?

Option 1 - switch using return: function myFunction(opt) { switch (opt) { case 1: return "One"; case 2: return "Two"; case 3: return "Three"; default: …

javascript return switch-statement break
How to use the switch statement in R functions?

I would like to use for my function in R the statement switch() to trigger different computation according to the …

r switch-statement
Switch on ranges of integers in JavaScript

I want to do something like this switch (this.dealer) { case 1-4: // Do something. break; case 5-8: // Do something. break; …

javascript switch-statement
Java: using switch statement with enum under subclass

First I'll state that I'm much more familiar with enums in C# and it seems like enums in java is …

java enums switch-statement
Switch: Multiple values in one case?

I have the following piece of code, but yet when I enter "12" I still get "You an old person". Isn't 9 …

c# switch-statement case
Can I use a case/switch statement with two variables?

I am a newbie when it comes to JavaScript and it was my understanding that using one SWITCH/CASE statements …

javascript switch-statement case