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.

Should we break the default case in switch statement?

Assuming this example code (source): #include <stdio.h> void playgame() { printf( "Play game called" ); } void loadgame() { printf( "Load …

c switch-statement break
How to reduce if statements

The program below functions as necessary but how do I reduce the amount of if statements. I have been told …

java if-statement switch-statement fizzbuzz
Is it possible use a class name in java switch/case statement?

I would like to use a java switch statement, which uses class names as case constants. Is it possible somehow? …

java switch-statement constants final class-names
Switch Case Assembly Language

I am looking at the assembly language code of a switch statement. I understand how the code works and what …

assembly x86 switch-statement disassembly
Reverse Polish Notation Java

I want to make Reverse Polish Notation algorithm, but my code isn't working. Can anyone explain me why ? In my …

stack switch-statement case token rpn
How do I disable a UISwitch?

Is this possible to disable a UISwitch? I do not mean putting it in an OFF state, I mean disabling …

iphone objective-c switch-statement uiswitch
C# switch in lambda expression

Is it possible to have a switch in a lambda expression? If not, why? Resharper displays it as an error.

c# lambda expression-trees switch-statement
c# switch statement is return suitable to replace break

Is this an appropriate way to handle c# switch statements or is an explicit break required still? reference public static …

c# case switch-statement
How to change textcolor of switch in Android

I'm creating an application which uses Android 4.0. I'm wondering if it is possible to change the text color of the …

android switch-statement android-4.0-ice-cream-sandwich
Using `continue` keywoard in a switch nest inside a foreach loop

I have the code below (which actually is much longer than you see!) foreach (SensorPair sensor in _sensorPairs) { sensorByte = (byte) …

c# loops foreach switch-statement continue