Comment (computer Programming) - Overview

Overview

Comments are generally formatted as block comments (also called prologue comments or stream comments) or line comments (also called inline comments).

Block comments delimit a region of source code in which the region is allowed to span multiple lines. This region is specified with a start delimiter and an end delimiter. Some programming languages (such as MATLAB) allow block comments to be recursively nested inside one another, but others (such as Java) do not.

Line comments either start with a comment delimiter and continue until the end of the line, or in some cases, start at a specific column (character line offset) in the source code, and continue until the end of the line.

Some programming languages employ both block and line comments with different comment delimiters. For example, C++ has block comments delimited by /* and */ that can span multiple lines and line comments delimited by //. Other languages support only one type of comment. For example, Ada comments are line comments: they start with -- and continue to the end of the line.

Read more about this topic:  Comment (computer Programming)