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.

Eclipse: how to switch between console window and editor?

I'm using Eclipse for Python and R development. How can I jump between editor tab and console window using a …

eclipse tabs switch-statement hotkeys
Why is GCC warning me about a fallthrough even when I use [[fallthrough]]?

In the following piece of code, I use the standard [[fallthrough]] attribute from C++1z to document that a fallthrough …

c++ switch-statement c++17 fall-through
Multiple/repeating cases in a Java switch statement

I would like to know how Java handles multiple identical instances of the same case. I think the following makes …

java switch-statement multiple-instances
Binary operator '~=' cannot be applied to operands of type 'String' and 'String?'

I have a simple switch-statement that is not that simple. switch(bubble?.name){ //bubble is SKPhysicsBody case "largeBubble": // <= error …

swift switch-statement skphysicsbody
is there a way in PHP to restart a loop in a foreach, or change the test value in a switch?

if i'm looping over an array, and while in the middle of one of the loops i discover some small …

php loops foreach switch-statement continue
How can I get this switch statement to work using a scanner?

I'm trying to write a program that will switch any letter of the alphabet (upper or lower cases) into the …

java string switch-statement java.util.scanner phonetics
How to handle multiple values inside one case?

How to handle multiple values inside one case? So if I want to execute the same action for value "first …

c# .net switch-statement case-statement
How does switch compile in Visual C++ and how optimized and fast is it?

As I found out that I can use only numerical values in C++'s switch statements, I thought that there …

c++ visual-c++ if-statement switch-statement visual-c++-2010
Is it safe to assume strict comparison in a JavaScript switch statement?

I have a variable that can either be boolean false, or an integer (including 0). I want to put it in …

javascript types comparison type-conversion switch-statement
Switch fallthrough in Dart

I started learning Dart today, and I've come across something that my google skills are having trouble finding. How do …

switch-statement dart fall-through