# switch Statement

*noun*

say it: **“SWICH STAYT-ment”** **/swɪtʃ ˈsteɪtmənt/**

A C# statement that compares one value with a list of cases and runs the code for the one that matches.

## What is **switch Statement** in C#?

**switch Statement** — A statement that compares one value against a list of cases and runs the one that matches, or `default` when none does. In C# a case can't fall through into the next: each one ends with `break` or `return`.

```csharp
string size = "M";
switch (size)
{
    case "S": Console.WriteLine("Small"); break;
    case "M": Console.WriteLine("Medium"); break;
    default: Console.WriteLine("Large"); break;
}
// Medium
```

## In a sentence

- “I replaced six else-ifs on the shirt size with one **switch statement**.”

Level: Apprentice · [More C# terms at this level](https://www.ask-codey.com/glossary?category=c-sharp&level=2)

Updated: October 28, 2026

## In other subjects

- [switch Statement in Java](https://www.ask-codey.com/glossary/switch-statement)
- [switch Statement in JavaScript](https://www.ask-codey.com/glossary/switch-statement-javascript)

Source: https://www.ask-codey.com/glossary/switch-statement-c-sharp
