Advertisement
mjc65

Example 1-63. goto in a switch statement

Jun 23rd, 2020
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.26 KB | None | 0 0
  1. int i = 1;
  2. switch (i)
  3. {
  4.     case 1:
  5.         {
  6.             Console.WriteLine("Case 1");
  7.             goto case 2;
  8.         }
  9.     case 2:
  10.         {
  11.             Console.WriteLine("Case 2");
  12.             break;
  13.         }
  14. }
  15.  
  16. // Displays
  17. // Case 1
  18. // Case 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement