Mega Code Archive

 
Categories / C# / Language Basics
 

Empty cases can fall through

/* C#: The Complete Reference  by Herbert Schildt  Publisher: Osborne/McGraw-Hill (March 8, 2002) ISBN: 0072134852 */ // Empty cases can fall through.    using System;    public class EmptyCasesCanFall {      public static void Main() {      int i;        for(i=1; i < 5; i++)         switch(i) {          case 1:          case 2:          case 3: Console.WriteLine("i is 1, 2 or 3");            break;          case 4: Console.WriteLine("i is 4");            break;        }      }  }