Created
September 2, 2012 04:11
-
-
Save nonopolarity/3594786 to your computer and use it in GitHub Desktop.
Objective-C 2.0 for ... in loop, using Fast Enumeration, looping through dictionary key-value pairs and values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary *dictionary = @{ | |
@"hello" : @"world", | |
@12 : @"foo", | |
@123.456 : @56, | |
@"how are you" : @1 | |
}; | |
for (id key in dictionary) { | |
NSLog(@"key is %@ and value is %@", key, [dictionary objectForKey:key]); | |
} | |
for (id v in [dictionary objectEnumerator]) { | |
NSLog(@"value is %@", v); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment