This variant of the for loop sets up a fast enumeration. var is a variable whose type can also be declared , expression is an expression that produces a result that conforms to the NSFastEnumeration protocol.Typically, expression is a collection, such as an array or a dictionary.
for ( var in expression )
programStatement
Ex: for (NSString *empName in employees) {
NSLog(@"empName = %@", empName);
}
Note: The fast enumeration is not index based like for loop.
No comments:
Post a Comment