fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. var x = 1;
  8. if (true) {
  9. Console.WriteLine(x);
  10. if (x < 10) {
  11. var x = 20;
  12. Console.WriteLine(x);
  13. }
  14. Console.WriteLine(x);
  15. }
  16. }
  17. }
Compilation error #stdin compilation error #stdout 0.03s 23888KB
stdin
Standard input is empty
compilation info
prog.cs(11,15): error CS0136: A local variable named `x' cannot be declared in this scope because it would give a different meaning to `x', which is already used in a `parent or current' scope to denote something else
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty