switch tutorial csharp code example
Example: csharp switch case
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("Enter a number");
int number = Convert.ToInt32(Console.ReadLine());
switch (number)
{
case 1:
Console.Clear();
Console.WriteLine("one");
break;
case 2:
Console.Clear();
Console.WriteLine("two");
break;
default:
Console.Clear();
Console.WriteLine("Default case");
break;
}
}
}