title: Scope of variable with out parameter
body: <p><strong>Example:</strong></p>
  
  <p>I have the following code block:</p>
  
  <pre><code>if (!int.TryParse("123", out var parsedNumber))
  {
      return;
  }
  
  Console.WriteLine(parsedNumber);
  </code></pre>
  
  <p>The output in console is: 123</p>
  
  <p><strong>Question:</strong></p>
  
  <p>How is it possible, that the line <code>Console.WriteLine(parsedNumber);</code> knows about <code>parsedNumber</code>? </p>
  
  <p>According to my understanding, <code>parsedNumber</code> should only available in the <code>if-block</code>, shouldn't it?</p>
  
  <p>If I try this: </p>
  
  <pre><code>foreach (var data in dataList)
  {
     data += "something";
  }
  
  Console.WriteLine(data);
  </code></pre>
  
  <p><code>Console.WriteLine(data);</code> can't find <code>data</code>.</p>
  
  <hr>
  
  <p>I think, that the solution is the out parameter, but I'm not sure. Can someone explain this?</p>