Skip to content

Instantly share code, notes, and snippets.

@akio0911
Created May 26, 2009 10:56
Show Gist options
  • Save akio0911/118011 to your computer and use it in GitHub Desktop.
Save akio0911/118011 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
int main() {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSMutableDictionary *dictionary =
[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:1], @"red",
[NSNumber numberWithInt:2], @"green",
[NSNumber numberWithInt:3], @"blue",
nil];
NSLog(@"%@", dictionary);
for(NSString *key in [dictionary allKeys]){
int count = [[dictionary objectForKey:key] intValue];
[dictionary setObject:[NSNumber numberWithInt:count+10]
forKey:key];
}
NSLog(@"%@", dictionary);
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment