title: Creating 20 objects in a loop
body: <p>I need some newbie help.
  So basically im trying create 20 individual objects (players). Each player has a name , age and height.</p>
  
  <p>Instead of writing 'Person *player = [[Person alloc] init];' Twenty times, I have made a loop.
  I think the loop has worked because the [myArray count] has 20 objects.</p>
  
  <p>My questions:</p>
  
  <p>Are the 20 objects unique ( all with same name, age, height) ?</p>
  
  <p>Whats the best way to give each object in each element of MyArray a name,age,height ?</p>
  
  <p>So my end goal is to be able to do something like this:</p>
  
  <pre><code>NSLog(@"%@ is %i high and is %i years old", player1.name, player1.height, player1.age);
  
  NSLog(@"%@ is %i high and is %i years old", player2.name, player2.height, player2.age); 
  </code></pre>
  
  <p>etc...</p>
  
  <p>I hope the above makes sense and I really appreciate your help.</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  #import "Person.h"
  
  int main (int argc, const char * argv[]) {
      NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  
  
      NSMutableArray  *myArray = [[NSMutableArray alloc]initWithCapacity:20];
  
  
      for (int i = 0; i &lt; 20; i++)
      {
          Person *player = [[Person alloc] init];
          player.age = 10;
          player.height = 10;
          player.name = @"player";
          [myArray addObject:player];       
          [player release];         
      }
  
      NSLog(@"The number of players in myArray = %i", [myArray count]); // I now have 20 players (objects) in myArray.
  
  //How can I now give each player object an individual name, age &amp; height ??     
      [pool drain];
      return 0;
  }
  </code></pre>