Nil and nil

Discussion in 'iOS Programming' started by xcodeNewbie, Jul 22, 2011.

  1. macrumors member

    Joined:
    Jul 1, 2011
    #1
    When I start typing "nil" in Xcode the auto-completion comes up with two options, "nil" and "Nil". I am wondering what the difference is between these two are? Thanks in advance.
     
  2. macrumors 603

    Joined:
    Aug 9, 2009
    #2
    Nil.


    None. Nothing. Nonexistent. No difference.
     
  3. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #3
    Afaik, NULL, nil, null, Nil, are all the same.
    I think 'nil' is the most common used.
     
  4. macrumors 68040

    Joined:
    Apr 22, 2005
    #4
    While they are the same, the generally accepted style is to use nil when dealing with any objective-c object types, and NULL if it's a (void *). In other words, nil is the correct Objective-C style, and NULL is the correct C style.
     
  5. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #5
    I second this.
     

Share This Page