title: Objective C ternary operator vs if statements nil check
body: <p>Im checking to see if an array is nil and if it is I want to set some counter variable to 0 and to the length of the array if the array is not nil.</p>
  
  <pre><code>NSUInteger count = 0;
  if (self.someArray == nil) {
      count = 0;
  }
  else {
      count = self.someArray.count;
  }
  </code></pre>
  
  <p>and this works fine just as expected. However when I try to do something like this:</p>
  
  <pre><code>NSUInteger count = (self.someArray == nil) ? 0 : self.someArray.count
  </code></pre>
  
  <p>I get an <code>[NSNull count] unrecognized selector</code> error. However, when I do this</p>
  
  <pre><code>([self.someArray isKindOfClass:[NSNull class]]) ? 0 : self.someArray.count` 
  </code></pre>
  
  <p>It seems like the latter should work to me but is there something simple that I am overlooking? <code>NSNull</code> is for objects that are nil right? Why is the simple nil check working in the if statement and not in the ternary operator?</p>