Jacob
Jacob

Reputation: 1459

For Loop with NSDictionary

Just a quick question, when i do a for loop like this

for (NSDictionary *dic in myarray){
}

where in the array does it start, does it start from the last object, or from 0?

Thanks :D

Upvotes: 0

Views: 460

Answers (2)

Jay Imerman
Jay Imerman

Reputation: 4600

I would do it like this:

NSDictionary *dict;
for(NSInteger i=0; i<[array count]; i++){
    dict = [array objectForIndex:i];
    // your stuff here
}

Upvotes: 0

Himanshu A Jadav
Himanshu A Jadav

Reputation: 2306

it starts from 0. in case if you need further clarifications.

Upvotes: 4

Related Questions