Question: I have an `NSArray` of `NSDictionary`.
Each dictionary in the array has three keys: 'Name', 'Sex' and 'Age'

How can I find the index in `NSArray` of `NSDictionary` where, for example, `Name = 'Roger'`?

Answer: 
On iOS 4.0 and up you can do the following:

```
- (NSUInteger) indexOfObjectWithName: (NSString*) name inArray: (NSArray*) array
{
    return [array indexOfObjectPassingTest:
        ^BOOL(id dictionary, NSUInteger idx, BOOL *stop) {
            return [[dictionary objectForKey: @"Name"] isEqualToString: name];
    }];
}

```

Elegant, no?
If you're using iOS > 3.0 you will be able to use the `for in` construct.

```
for(NSDictionary *dict in myArray) {
  if([[dict objectForKey:@"Name"] isEqualToString:@"Roger"]) {
    return [myArray indexForObject:dict];
  }
}

```