Switch statements

suggest change

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.

A switch statement is often more concise and understandable than if...else if... else.. statements when testing multiple possible values for a single variable.

Syntax is as follows

switch(expression) {
   case constant-expression:
      statement(s);
      break;
   case constant-expression:
      statement(s);
      break;
  
   // you can have any number of case statements
   default : // Optional
      statement(s);
      break;
}

there are sevaral things that have to consider while using the switch statement

Example can be given with the grades wise

char grade = 'B';

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Conditional Statements:
* Switch statements

Table Of Contents
3 Conditional Statements
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script