title: Difference between an empty array and an array set to nil when fetching objects?
body: <p>From the lynda.com core data course. Simon mentioned that if the <code>fetchedobjects</code> array WAS empty, i.e. there are no managed objects in the store then the code would work fine and no error would be logged. </p>
  
  <p>However if the <code>fetchedobjects</code> array was set to <code>nil</code> then the error would display.</p>
  
  <p>But isnt the <code>fetchedobjects</code> array set to <code>nil</code> when the pointer of the array is created (a line before the if statement)?</p>
  
  <p>I might be having trouble differentiating between a <code>nil</code> array and an empty array. Can someone untangle this for me? thankyou.</p>
  
  <pre><code>- (IBAction)fetchObjects:(id)sender {
  
  NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
  NSEntityDescription *entity = [NSEntityDescription entityForName:@"Course" inManagedObjectContext:[self managedObjectContext]];
  [fetchRequest setEntity:entity];
  
  NSError *error = nil;
  NSArray *fetchedObjects = [[self managedObjectContext] executeFetchRequest:fetchRequest error:&amp;error];
  if (fetchedObjects == nil) {
      NSLog(@"Problem! %@",error);
  }
  
  for (Course *c in fetchedObjects) {
      NSLog(@"Course: %@ by author: %@", c.title, c.author);
  }
  
  }
  </code></pre>