RosettaCodeData/Task/Associative-array-Iteration/Objective-C/associative-array-iteration-3.m
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

9 lines
423 B
Objective-C

NSDictionary *myDict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:13], @"hello",
[NSNumber numberWithInt:31], @"world",
[NSNumber numberWithInt:71], @"!", nil];
// iterating over keys and values:
[myDict enumerateKeysAndObjectsUsingBlock: ^(id key, id value, BOOL *stop) {
NSLog(@"key = %@, value = %@", key, value);
}];