title: IOS/Objective-C: Access to variables within switch statements
body: <p>I have a switch statement that in most cases returns static values but in a few cases, I would like to call a function to get a value. Accordingly, I have put curly braces inside the case which apparently defines a scope for variables.</p>
  
  <p>I can get the value within the scope of the switch case but am having trouble getting it out of the case so that I can use it later.</p>
  
  <p>When I do:</p>
  
  <pre><code>case 2018:
           {
               NSString * myText = [self getMyText];
               NSArray *myTextArr = [myText componentsSeparatedByString:@"**"];
               responseOptions = myTextArr;
           }
  myOutsideArr = myTextArr;  ///This throws an undeclared identifier error
               break;
  </code></pre>
  
  <p><code>responseOptions</code> is not recognized outside the braces.</p>
  
  <p>Is there any way to access the value from the scope defined by the braces?</p>
  
  <p>Thanks in advance for any suggestions.</p>