Annotation characters for various programming languages

Source: Internet
Author: User
Tags ocaml

Comment comparison

There is a wide variety of syntax styles for declaring comments in source code. In italics are used here to BlockComment indicate block comment style. InlineComment In italics are used here to indicate inline comment style.

Language In-line Comment Block Comment
Ada, Eiffel, Euphoria, Occam, SPARK, ANSI SQL, ToolBook openscript, and VHDL -- InlineComment
ALGOL 60 comment BlockComment;
ALGOL 68 ¢ BlockComment ¢

comment BlockComment comment
co BlockComment co
BlockComment #
£ BlockComment £

AppleScript -- InlineComment (* BlockComment *)
Assembly language (varies) InlineCommentOne example (most assembly languages with line comments only)
AutoHotkey InlineComment /* BlockComment */
AWK, Bash, Bourne shell, C shell, Maple, Python, R, TCL, and Windows PowerShell InlineComment <# BlockComment #>
BASIC (various dialects): InlineComment(Not all dialects)

REM InlineComment

C (K&r, ANSI/C89/C90), CHILL, pl/i, and REXX /* BlockComment */
C (C99), C + +, Go, and JavaScript // InlineComment /* BlockComment */
C# // InlineComment
/// InlineComment(XML documentation Comment)
/* BlockComment */
/** BlockComment */(XML documentation Comment)
Cobol InlineComment(When * was in column 7)
Curl || InlineComment |# BlockComment #|

|foo# BlockComment #|

Cobra InlineComment /# BlockComment #/(nestable)
D // InlineComment
/// Documentation InlineComment(Ddoc comments)
/* BlockComment */
/** Documentation BlockComment */(Ddoc comments)

/+ BlockComment +/(nestable)
/++ Documentation BlockComment +/(Nestable, Ddoc comments)

DCL $! InlineComment
ECMAScript (JavaScript, ActionScript, etc.) // InlineComment /* BlockComment */
Forth InlineComment BlockComment )(Single line only)

before -- after )Stack Comment Convention

FORTRAN 66/77 InlineComment(The letter ' C ' in the first column makes the entire line a comment).
Fortran 90 InlineComment(all characters to the line, from the exclamation mark onwards, is comments)
Haskell -- InlineComment {- BlockComment -}
Java // InlineComment /* BlockComment */

/** BlockComment */(Javadoc documentation Comment)

Lisp and Scheme InlineComment #| BlockComment |#
Lua -- InlineComment --[==[ BlockComment]==](variable number of = signs)
Maple InlineComment (* BlockComment *)
Mathematica % (* BlockComment *)
Matlab InlineComment %{
BlockComment (nestable)
%}

Note:both Percent–bracket symbols must is the only non-whitespace characters on their respective lines.
Object Pascal (Delphi) // InlineComment (* BlockComment *)
BlockComment }
OCaml (* BlockComment (* nestable *) *)
Pascal, Modula-2, Modula-3, Oberon, and ML: (* BlockComment *)(OCaml comments is nestable)
Perl and Ruby InlineComment =begin
BlockComment
=cut
(POD documentation Comment)

__END__
Comments after end of code

Php InlineComment
// InlineComment
/* BlockComment */
/** Documentation BlockComment */(PHP Doc comments)
PILOT R:InlineComment
PL/SQL and TSQL -- InlineComment /* BlockComment */
REALbasic ‘ InlineComment
// InlineComment
rem InlineComment
Sas BlockComment;
/* BlockComment */
Seed7 InlineComment (* BlockComment *)
Simula comment BlockComment;
BlockComment;
Smalltalk "BlockComment"
Smarty {* BlockComment *}
Standard ML (* BlockComment *)
TeX, LaTeX, PostScript, Erlang, and S-lang InlineComment
Texinfo @c InlineComment

@comment InlineComment

TUTOR InlineComment
command $$ InlineComment
Visual Basic ‘ InlineComment
Rem InlineComment
Visual Basic. NET ‘ InlineComment

‘‘‘ InlineComment(XML documentation Comment)
Rem InlineComment

Visual Prolog InlineComment /* BlockComment */

Reference recommendation:

Comparison of programming languages (Syntax) (wiki)

Annotation characters for various programming languages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.