Switch Statements
This lesson discusses switch statements in C# using an example
Switch Case
Typically this is required when based on different values of a particular expression, different actions need to be performed. The basic construct of a switch case looks as follows:
switch (expression){case constant-expression:statementjump-statementdefault:statementjump-statement}
-
In code block above the
expression
can have multiple values. Essentially:- string
- integer
-
case
section withconstant-expression
can have the value as