I am using a NSMutableArray in which certain elements are there, at a part of coding i replace a object(NSString) with another object(NSString) then the element is replaced but on the another part of coding when i used that array with a loop then it will leave the index of replaced object and iterate the rest loop completly

the code for replace object are...

```
lbl = (UILabel *)[self.view viewWithTag:buttonValue + 250];
    NSString *str = lbl.text;
    for (int i=0; i< [appDelegate.dataArray count]; i++){
        if ([appDelegate.dataArray objectAtIndex:i] == lbl.text)
        {
            [appDelegate.dataArray replaceObjectAtIndex:i withObject:city];
        }
    }

```

code for reusing array with loop are...

```
for (int i = 0; i<[appDelegate.dataArray count];i++){
        dictionary = [appDelegate.countryListArray objectAtIndex:i];
        NSString *str = [NSString stringWithFormat:@"%@",[dictionary valueForKey:@"countryCity"]];
    if ([sLocation isEqualToString:str] ){
        sLocation = [dictionary valueForKey:@"continentCity"];
    }

```