Created
August 1, 2013 17:27
-
-
Save LoganBarnett/6133464 to your computer and use it in GitHub Desktop.
An example of silliness if C#'s scoping rules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(true) { | |
var bar = "bazz"; | |
DoSomethingWithBar(bar); | |
} | |
var bar = "qux"; // oh noes! You already declared bar even though you can't get to it and it's out of scope. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment