Comments

Comments denote pieces of text that are ignored by the compiler. The primary purpose of comments are to make the compiler ignore some piece of code during debugging, or to document the purpose of your code (for your sanity, and for making it obvious what's happening when sharing your code with others).

In VC, two styles of comments are supported: line comments (//) and block comments (/* ... */).

  1. Line comments: If you type a double slash (//) in your code, everything on that line after the slashes will be ignored.
    void DexterJoin()
    {
    	AddPlayer(3);
    }
    
  2. Block comments: The second method of commenting is to use /* and */. When the compiler encounters a /*, everything will be ignored until it sees a */. Example:

    void DexterJoin()
    {
    	/* This is the part where Dexter joins after
    	being seen on the path of Jujube mountains.
    	The event below is number 75. */
    	
    	addcharacter(3);
    }
    

    /* ... */ comments don't nest, so putting one inside another one will not work as intended:

    /*
        This is a test.
        /* This is a nested comment */
        After that comment, everything here is an error.
    */
    

The // is preferred for simple phrases that you wish commented, while the /* */ method is best for large areas of text to be left commented.

Helpful Tip: Try using commenting if you have a problematic area of your VC code that refuses to compile. Use comments around parts that are creating errors, and try recompiling until you can isolate the problem.

Talkback

Post a new comment?

Talkback #2 written by anonymous on 2004-07-13.

Also, the /* */ comments will not nest: /* Comments blah blah blah /* More Comments */ */ DOESN'T WORK

Talkback #1 written by Interference22 on 2004-06-09.

Commenting your code is general practice for creating a VERGE game, especially one with large quantities of code since it helps organise your work into understandable sections and answers the age-old coding question "What the hell was I doing?" by allowing you to provide a brief running commentary of what particular sections of your code do.

Post a new comment?

Doc Nav

Your docs
View All Docs

If you log in, you can edit the documentation, or create your own documents and tutorials!

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.