Mark As Completed Discussion

Try this exercise. Fill in the missing part by typing it in.

In C#, the switch statement is used to perform different actions based on the value of a ____ expression.

The switch statement consists of multiple case labels and an optional default label.

Here's an example:

TEXT/X-CSHARP
1int num = 3;
2
3switch (num)
4{
5    case 1:
6        Console.WriteLine("One");
7        break;
8    case 2:
9        Console.WriteLine("Two");
10        break;
11    case 3:
12        Console.WriteLine("Three");
13        break;
14    default:
15        Console.WriteLine("Other");
16        break;
17}

Write the missing line below.