Thursday, March 10, 2011

The Underestimated Comment

As a programmer I am as guilty as the next guy about not commenting my code. But it really is an important ingredient in any piece of code. I have gone back into code I wrote a couple years ago ... eh who am I kidding even a couple months ago, and looked at the code and thought, "what was I doing that for?". I have also on numerous occasions had the opportunity to trouble shoot someone else's code, and let me tell you how much easier it is when it is well documented with comments in the code. So today I wanted to share with you just how to comment in several programming languages.

How to Comment in C#
// This is a comment in C# code

/* This is also a comment in C#
     It can be used for comment multiple lines */

How to Comment in VB
' This is a comment in VB

How to Comment in CSS
/* This is a comment in CSS */

How to Comment in Javascript
// This is a comment in Javascript

How to Comment in HTML
<!-- This is a comment in HTML -->

How to Comment in Perl 
# This is a comment in Perl

How to Comment in PHP
// This is a comment in PHP
/* This is also a comment in PHP
     It can be used for comment multiple lines */

How to Comment in XML
<!-- This is a comment in XML -->

How to Comment in ASP (pre .Net)
' This is a comment in ASP

No comments: