PrimitiveType

Commenting Your Code

Programmers can place comments (sometimes called remarks) in their code that help explain what is going on. These comments are not executed as program statements.

It is common for novice programmers to underestimate the value of commenting code. Through bitter experience most come to learn this good practice after attempting to read another programmer's code or their own several months down the line.

In a text editor that supports syntax highlighting, comments will typically be displayed in an unobtrusive colour & sometimes in italics.

There are several styles of commenting code. Here's a small selection:

HTML comment:
<!-- This is a comment -->

C-style single line comment:
// This is a comment

C-style multi-line comment:
/*
These are my comments
over multiple lines
*/

Special JavaDoc comments (these are picked up by the Java documentation system):
/**
* This is a comment about a function or aspect of my class
*
*/

VB comment:
' This is a comment

Perl comment
# This is a comment