/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
publicclass ValuesFallThrough
{
staticvoid Main()
{
String myChoice = "NewLeft";
// switch on the string value of myChoice
switch (myChoice)
{
case "NewLeft":
Console.WriteLine(
"The NewLeft members are voting Democratic.");
gotocase "Democrat";
case "Democrat":
Console.WriteLine("You voted Democratic.\n");
break;
case "CompassionateRepublican": // fall through
case "Republican":
Console.WriteLine("You voted Republican.\n");
Console.WriteLine("Don't you feel compassionate?");
break;
case "Progressive":
Console.WriteLine("You voted Progressive.\n");
break;
default:
Console.WriteLine("You did not make a valid choice.");
break;
}
Console.WriteLine("Thank you for voting.");
}
}