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.

Java Switch Statement - Is "or"/"and" possible?

I implemented a font system that finds out which letter to use via char switch statements. There are only capital …

java char switch-statement
C# Switch-case string starting with

Is there any way to make a case condition in a switch statement where you say if a string begins …

c# string switch-statement case
SQL use CASE statement in WHERE IN clause

Is it posible to use case in where in clause? Something like this: DECLARE @Status VARCHAR(50); SET @Status='published'; SELECT * …

sql select switch-statement case where-in
When to use If-else if-else over switch statements and vice versa

Why you would want to use a switch block over a series of if statements? switch statements seem to do …

switch-statement
Can Objective-C switch on NSString?

Is there a more intelligent way to rewrite this? if ([cardName isEqualToString:@"Six"]) { [self setValue:6]; } else if ([cardName isEqualToString:@"Seven"]) { […

objective-c switch-statement
Combine return and switch

How can I combine return and switch case statements? I want something like return switch(a) { case 1:"lalala" case 2:"blalbla" …

c# switch-statement switch-expression
C - Switch with multiple case numbers

So my professor asked us to create a switch statement. We are allowed to use only the "SWITCH" statement to …

c switch-statement case
Does a break statement break from a switch/select?

I know that switch/select statements break automatically after every case. I am wondering, in the following code: for { switch …

select switch-statement go break
Getting a bunch of crosses initialization error

I have this snippets of code taken from a downloaded example: bool ChatServer::event(QEvent * event) { if(event->type() == …

c++ g++ initialization switch-statement
Use an array as a case statement in switch

I am trying to do something like this, i.e., use an array in a switch statement. Is it possible …

java arrays switch-statement