will a fast enumeration of an array always go in index order?
for (NSDictionary *zone in myArray)
{
//do code
}
will that always enumerate from index location 0, 1, 2, ..., n?
i prefer fast enumeration over a standard for loop since it makes the code easier to read.
Yes it will:
For collections or enumerators that have a well-defined order—such as an NSArray or an NSEnumerator instance derived from an array—the enumeration proceeds in that order, so simply counting iterations gives you the proper index into the collection if you need it.
docs here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With