mjc65

Example 1-62. A switch statement

Jun 23rd, 2020
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. void CheckWithSwitch(char input)
  2. {
  3.     switch (input)
  4.     {
  5.         case 'a':
  6.         case 'e':
  7.         case 'i':
  8.         case 'o':
  9.         case 'u':
  10.             {
  11.                 Console.WriteLine("Input is a vowel");
  12.                 break;
  13.             }
  14.         case 'y':
  15.             {
  16.                 Console.WriteLine("Input is sometimes a vowel.");
  17.                 break;
  18.             }
  19.         default:
  20.             {
  21.                 Console.WriteLine("Input is a consonant");
  22.                 break;
  23.             }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment