Adding Comments in ASP Code

Wednesday, August 15, 2012

tags ASP

Adding comments to your code is important no matter which language you are coding in. While adding comments to your code may seem unnecessary, they become quite valuable when you need to revisit your code in the future. Comments are simply used as reminders or how to explain how a certain section of your code works. In ASP, there are two ways to add comments to your code. You can either use the single quote or add the keyword rem before your comment.


<%

' this is a comment
Rem this is another comment.

Response.Write("Hello!") 'another comment    
%>


As you can see if you run this code, comments do not get displayed in the browser. When adding comments to your code, keep in mind that you should not "over" comment. Adding unnecessary comments will just increase the size of your document. The ASP engine has to go through each line of your code before completing the process of returning HTML back to the web server. You should add comments that will help you debug your ASP code in the future.

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

ASP In A Nutshell Sams Teach Yourself Active Server Pages 3.0 in 21 Days Beginning ASP Databases