Placed in: Home
Making comments in your source code

Commenting is absolutely necessary when programming. It's useful to you because you won't forget what you were doing or thinking at that time. But it's expecially useful for others because they'll know how to work with your code.

Every programming language has it's own way of making comments, which can be very annoying. Never had that you were making Java comments on your HTML page? Here's a small list of some programming languages with their way of commenting. Alltough CSS, HTML and MySQL aren't real programming languages, I posted them in this list because it can be useful for webdesigners.

Did you comment your code correct?

Take note that there could be more ways to comment your code. Just make sure you pick one universal type in all your code.

  • Actionscript

    Single line comment:
    // Comments

    Multiline comment:
    /**
    * Comments line one
    * Comments line two
    **/

  • C++

    Inline comment:
    // Comments

    Single line comment:
    /* Comments */

    Multiline comment:
    /*
    * Comments line one
    * Comments line two
    */

  • CSS

    Commenting:
    /* Comments */

  • Delphi

    Single line comment:
    // Comments

    Multiline comment:
    {
    Comments line one
    Comments line two
    }

  • HTML / XHTML / XML

    Commenting:
    <!-- Comments -->

  • Java

    Single line comment:
    // Comments

    Multiline comment:
    /**
    * Comments line one
    * Comments line two
    **/

  • MySQL

    Single line comment:
    -- Comments

    Multiline comment:
    --
    -- Comments line one
    -- Comments line two
    --

  • PHP

    Single line comment:
    // Comments

    Multiline comment:
    /*
    # Comments line one
    # Comments line two
    */


Tags:  useful tips comments programming programming languages

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Digg!Reddit!Del.icio.us!Facebook!Technorati!StumbleUpon!Newsvine!Furl!Ma.gnolia!
Comments
Add NewSearchRSS
Suru - SQL Comments   2008-03-22 02:44:14
Gravatar image SQL

--Single Line

/*
Comment Line 1
Comment Line 2
*/
izasdk - php comments   2009-03-11 14:28:03
Gravatar image the
/*
# Comments line one
# Comments line two
*/
looks a little bit like you have to put the '#'s there but there is no need for this (i prefer the c-style)
Just like multi-line-commenting in the previos comment

And last but not least you could also use the # for a single-line-comment in php ;-)
Read more...
Name:
Email:
  Gravatar enabled.
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Unsubscribe from e-mail notifications.
 
< Prev   Next >
Subscribe

3513 people are subscribed for free to receive high quality articles.