Basic commenting question for Xcode

Discussion in 'Mac Programming' started by JBot, Mar 1, 2007.

  1. macrumors 6502

    Joined:
    Jan 9, 2006
    Location:
    Calgary.Alberta.Canada
    #1
    To comment a selected portion of your code, where do you go?
    Very basic question, i know you can do it with other editors, i just dont know where that option is on Xcode.
    Im writing in c++ if that matters.
     
  2. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #2
    you can use the // for single lines and /* */ for multiple lines.
    So if I had the code
    PHP:
    #include <iostream>

    int main()
    {
    //my program code goes here
    std::cout << "Hello world";
    /* I can have multiple paragraphs here
    as well see */
    return 0;
    }
     
  3. thread starter macrumors 6502

    Joined:
    Jan 9, 2006
    Location:
    Calgary.Alberta.Canada
    #3
    I know how to use that, but im wondering if there is a way for me to just highlight certain lines and go to the 'comment' button, and that will place the // infront of each individual line.
    Emacs has that capability, i would hope Xcode does also...
     
  4. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #4
    Under the Scripts menu (inbetween Window and Help) there are commands to comment and uncomment the current selection.

    b e n
     
  5. thread starter macrumors 6502

    Joined:
    Jan 9, 2006
    Location:
    Calgary.Alberta.Canada
    #5
    Thank you very much!
     

Share This Page