title: Objective-C enumerateObjectsUsingBlock vs fast enumeration?
body: <p>What are the advantages and disadvantages of the following two approaches:</p>
  
  <p><strong><a href="https://developer.apple.com/documentation/foundation/nsarray/1415846-enumerateobjectsusingblock?language=objc" rel="nofollow noreferrer">enumerate using block</a></strong></p>
  
  <pre><code>NSArray *myArray = [NSArray new];
  [myArray enumerateObjectsUsingBlock:^(id anObject, NSUInteger idx, BOOL *stop) {
      if (anObject == someOtherObject) {
          [anObject doSomething:idx];
          *stop = YES;
      }
  }];
  </code></pre>
  
  <p><strong><a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/FoundationTypesandCollections/FoundationTypesandCollections.html#//apple_ref/doc/uid/TP40011210-CH7-SW30" rel="nofollow noreferrer">fast enumeration</a></strong></p>
  
  <pre><code>NSArray *myArray = [NSArray new];
  int idx = 0
  for (id anObject in myArray) {
      if (anObject == someOtherObject) {
          [anObject doSomething:idx];
          break;
      }
      ++idx;
  }
  </code></pre>