Fast enumeration


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. NSArray *array = [NSArray arrayWithObjects:
  2. @"One", @"Two", @"Three", @"Four", nil];
  3.  
  4. for (NSString *element in array) {
  5. NSLog(@"element: %@", element);
  6. }
  7.  
  8. NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
  9. @"quattuor", @"four", @"quinque", @"five", @"sex", @"six", nil];
  10.  
  11. NSString *key;
  12. for (key in dictionary) {
  13. NSLog(@"English: %@, Latin: %@", key, [dictionary valueForKey:key]);
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.