Use a char to control the switch. : Char : Data Type C# Examples


C# Examples » Data Type » Char »

 

Use a char to control the switch.









    
using  System;  
  
class  MainClass  {      
    public  static  void  Main()  {  
        char  ch;  
  
        for(ch='A';  ch<=  'E';  ch++)  
            switch(ch)  {  
                case  'A':    
                    Console.WriteLine("ch  is  A");  
                    break;  
                case  'B':    
                    Console.WriteLine("ch  is  B");  
                    break;  
                case  'C':    
                    Console.WriteLine("ch  is  C");  
                    break;  
                case  'D':    
                    Console.WriteLine("ch  is  D");  
                    break;  
                case  'E':    
                    Console.WriteLine("ch  is  E");  
                    break;  
            }          
    }  
}
    
   
  
   



Output

ch is A
ch is B
ch is C
ch is D
ch is E


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Char