Comment Code

From Hostek.com Wiki
Revision as of 02:38, 13 March 2015 by Kalebl (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are many different languages that use different comment structures. Some have single in-line comments. Some have multiple line comments. Many have both functions.

Here are some examples of comments for code that we support on our hosting packages.

HTML

HTML only has a multiple line comment structure. But it can be used for both single lines and multiple lines.

Single Line

<!-- This is a single line of comments -->

Multiple lines

<!--
This is
multiple lines
of comments
-->

ColdFusion

ColdFusion, much like HTML, only has a multiple line comment structure as well. There is a key difference though. ColdFusion requires the three dashes ("---") rather than the two that HTML uses.

Single Line

<!--- This is a single line of comments --->

Multiple lines

<!---
This is
multiple lines
of comments
--->

PHP

PHP does have the option of two single line comment structures, or a single multiple line comments.

Single Line

// This is a single line of comments

Single Line (Shell option)

# This is a single line of comments

Multiple lines

/*
This is
multiple lines
of comments
*/

Javascript

Javascript has one convention for single lines, and one convention for multiple lines.

Single Line

// This is a single line of comments

Multiple lines

/*
This is
multiple lines
of comments
*/

CSS

CSS only has a multi line convention as well, and can be used as such.

Single Line

/* This is a single line of comments */

Multiple lines

/*
This is
multiple lines
of comments
*/

Ruby

Ruby does have its own unique multi-line comment structure. It also has a single line comment feature that is fairly standard.

Single Line

# This is a single line of comments

Multiple Lines

=begin
This is
multiple lines
of comments
=end

Perl

Perl has only one comment structure, and that is a single line comment.

Single line

# This is a single line of comments

ASP

ASP has one single line comment structure as well. It can be a little trickier to spot, but it is a single quote at the very beginning of the line.

Single Line

'This is a single line of comments