13 Nov 2011

C# switch statement


The switch statement is a control statement that handles multiple selections and enumerations by passing control to one of the case statements within its body as the following example:
int caseSwitch = 1;
switch (caseSwitch)
{
case 1:
Console.WriteLine("Case 1");
break;
case 2:
Console.WriteLine("Case 2");
break;
default:
Console.WriteLine("Default case");
break;
}

No comments:

Post a Comment