title: distinguish between local scope and global scope variables with same name in swift
body: <p>how to distinguish between local scope and global scope variables with same name in "swift" (and in "objective-c")</p>
  
  <p>For eg:</p>
  
  <pre><code>var a = 10
  for i in 1...10 {
    var a = 20
    a = 40
  }
  </code></pre>
  
  <p>in this code snippet, how can I save 40 to the global variable "a" ? 
  Sorry if it's a duplicate question.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Changing any variable name is obviously possible, but I want to know if there any way to do this.</p>