title: Assigning objects to variable outside a block
body: <p>The following code crashes, since the contents of <code>sentence</code> go away when the final block exits.</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;    
  int main (int argc, const char * argv[]) {
      NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  
      // simple block test - just iterate over some items and 
      // add them to a string
      NSArray *items = [NSArray arrayWithObjects:@"why ", @"must ", @"this ",nil];
      __block NSString *sentence = @"";   
      [items enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop)
      {
          sentence = [sentence stringByAppendingFormat:@"%@",obj];
      }];
      // crash!
      NSLog(@"Sentence is %@",sentence);
      [pool drain];
      return 0;
  }
  </code></pre>
  
  <p>What is the correct / idiomatic way to make this work?</p>