Complete Noob question (what should I use for indenting?)

Discussion in 'Mac Programming' started by sirxavier, Mar 17, 2010.

  1. sirxavier macrumors newbie

    Joined:
    Oct 4, 2008
    #1
    Hi!

    Thanks for your attention.

    I am learning Objective-C from scratch(however I do know some C). I am using the Programming in Objective-C book and so far all is good, but there's something that has puzzled me since I started learning programming.... and it is.... what should I use for indenting?

    The examples in the book show 4 spaces indentation, so at first I thought... isn't pressing just tab easier? But then the indentations where too big... then I checked wikipedia and it says that using spaces or tab is a thing of preference?

    So far I have been pressing space 3 times for each indentation following the examples in the book... am I doing it right, isn't pressing space 3 times more cumbersome than pressing tab once? Should I stop worrying about this? :p

    Thanks again!
     
  2. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
  3. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #3
    You should try to make your code easy to follow. It's a matter of preference how much you indent each line.
     
  4. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #4
    Did you check XCode preferences / Indentation?
    Just set tab width = 4.
     
  5. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    If you're using Xcode, let it auto-indent for you: Preferences > Indentation > Syntax-aware indenting
     
  6. sirxavier thread starter macrumors newbie

    Joined:
    Oct 4, 2008
    #6
    I am using vim in terminal at the moment, but I will move to XCode soon enough... but now I know how to solve my problem to make it look like the book with only one key press! :)

    Thanks again!
     
  7. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #7
  8. sirxavier thread starter macrumors newbie

    Joined:
    Oct 4, 2008
    #8
  9. Cine22 macrumors newbie

    Joined:
    Jul 9, 2010
    #9
    Hi Friends, I am Cine and I have read your site in a very deep and I would like to appreciate you on this brilliant effort. You have provided some thing so much different that I can't have words for thanks.
     

Share This Page