July 12, 2011
MarkBernstein.org
 
Follow me on Twitter

Objective C Confusion

On page 45 of Craig Hockenberry’s iPhone App Development: the missing manual , we’re shown the idiom:

 if (exclamationCount != nil) {
     [exclamationCount release];
     exclamationCount = [nil retain];
     }

I'm missing something, obviously. Since [nil retain] does nothing and returns nil, so why not write

     exclamationCount=nil; ?