# Interviews - C# Corner

Describe the Switch Statement.
By in onSep 17 2019
• Sep, 2019 17

Syntax

Switch(variable){ case 0: . . .  case n-1: default:}

This is a type of control statement in which we are a single variable is checked for multiple values and if neither value matches the code corresponding to default is executed.

• Switch case does not allow variables to be taken as the case value.
• Only uniques case values are acceptable.
• Each case is suffixed by a break statement, to make sure that only the matched case code executes
import static java.lang.System.out; class Csharpcorner {  public static void main(String[] args)  {  int i=0;  switch(i)  {  case 0:  case 1:  case 2:  case 3:  case 4:  case 5:  case 6:out.print(i);  break;  default: out.print("No value");  }  } }

For a detailed tutorial on Java Control and Loop Statements please visit https://www.c-sharpcorner.com/article/java-loops-and-control-statements/

• 0