Mega Code Archive

 
Categories / C# / Language Basics
 

Switch statement containing a branch with no statements

/* Mastering Visual C# .NET by Jason Price, Mike Gunderloy Publisher: Sybex; ISBN: 0782129110 */ /*   Example4_7.cs illustrates the use of   the switch statement containing a branch   with no statements: causes a "fall-through"   to the next branch */ public class Example4_7 {   public static void Main()   {     int value = 1;     switch (value)     {       case 0:         System.Console.WriteLine("Zero");         break;       case 1:       case 2:         System.Console.WriteLine("One or two");         break;       case 3:         System.Console.WriteLine("Three");         break;       default:         System.Console.WriteLine("Other number");         break;     }   } }