fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var i = 2;
  9.  
  10. switch (i)
  11. {
  12. case 1:
  13. var what = "WHERE";
  14. break;
  15.  
  16. case 2:
  17. var what = "WHAT";
  18. break;
  19. }
  20. }
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(17,9): error CS0128: A local variable named `what' is already defined in this scope
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty