title: Confused about enumeration... How do I change the objects that during enumeration?
body: <p>Still new to Objective-C and I'm confused about enumeration...</p>
  
  <p>Let's say I have an NSArray of 8 "Car" objects and all of them have their "paintColor" property set to "red. I want to enumerate through the array and set each Car.paintColor property to "blue".  How do I do that?</p>
  
  <pre><code>for (Car *car in myArray){
      car.paintColor = @"blue";  
  }
  </code></pre>
  
  <p>But then if I do</p>
  
  <pre><code>Car *testCar = [myArray objectAtIndex:2];
  
  NSLog(@"The car color for 3rd object in myArray is %@", testCar.color);
  </code></pre>
  
  <p>I still get "red".   So  it seems that enumeration just creates a temporary object but doesn't modify the actual object that is contained in the array.</p>
  
  <p>What is the proper way to do what I'm trying to do?   I have lots of situations where I want to enumerate through an array but actually changes the items that are inside the array</p>
  
  <p>Thanks</p>
  
  <p>--EDIT</p>
  
  <p>Ok, thanks for that information.. can you explain why this doesn't work?</p>
  
  <p>I have an NSArray called "carsArray" set up as a property that contains three NSMutable string objects ("Buick", "Bronco", "Cadillac").</p>
  
  <p>I then do</p>
  
  <pre><code>for (NSMutableString *car in myArray) {
      car = [NSMutableString stringWithFormat:@"test"];
  }
  
  NSMutableString *temp = [myArray objectAtIndex:2];
  NSLog(@"third car is %@", temp);
  </code></pre>
  
  <p>NSLog is saying "Cadillac".  Shouldn't it be "test"?</p>