LANGUAGE
Block scope
A name declared in a block is limited by that declaration scope.
Formal Syntax & Structure
csharp syntaxcsharp
{ int local = 1; }Working Example
Example Snippetcsharp
if (true) { int n = 2; Console.WriteLine(n); }A name declared in a block is limited by that declaration scope.
{ int local = 1; }if (true) { int n = 2; Console.WriteLine(n); }