-2

In for loop we can simply define print data between 0 to 5 . Like this how we can define in Fast Enumeration?

for(int i=0;i<5;i++)
{ 
  NSLog(@"for loop");
}
S. Karthik
  • 618
  • 5
  • 16

1 Answers1

1

Fast Enumeration works for collection like

-NSSet

-NSArray

-NSDictionary

-NSMutableSet

-NSMutableArray

-NSMutableDictionary

NSArray *array = [[NSArray alloc]
initWithObjects:@"string1", @"string2",@"string3",nil];
for(NSString *aString in array)
{
  NSLog(@"Value: %@",aString);
}
ChenSmile
  • 3,401
  • 4
  • 39
  • 69