Pretty straightforward question here: is the enumeration order in a for
loop guaranteed to follow the order of an NSArray target (i.e. start at object index 0 and increment by 1 each time)?
Specifically, is the enumeration order in the following code snippet guaranteed to start at array index 0 and increment by 1 each loop? (codesArray
is an NSArray)
for (NSNumber *num in codesArray) {
// do stuff //
}
Or if I want to guarantee enumeration order do I have to do a traditional for
loop of the style:
for (int i=0; i<[codesArray count]; i++) {
// do stuff //
}
Thanks!
Yes, these will follow a guaranteed order as you would expect.
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