Movatterモバイル変換


[0]ホーム

URL:


Jump to content
Rosetta Code
Search

Comments

From Rosetta Code
Task
Comments
You are encouraged tosolve this task according to the task description, using any language you may know.
Task

Show all ways to include text in a language source file that's completely ignored by the compiler or interpreter.


Related tasks


See also
  •  Wikipedia
  •  xkcd (Humor: hand gesture denoting// for "commenting out" people.)



11l

// Single line comment\\ Also single line comment (continuation of the comment in previous line)\[ This isa multi linecomment ]\{ Andthis }\( Andthis )\‘ Andthis ’

360 Assembly

* An asterisk in column one denotes a comment line* Comments may also follow any syntactically complete instruction:          LA    1,0           Comment          NOP                 Comment (after a NOP instruction)* Comments after instructions with omitted operands require a comma ","         END   ,             Comment (without comma, "Comment" assumed an operand of "END")

4D

`Comments in 4th Dimension begin with the accent character and extend to the end of the line (until 4D version 2004).// This is a comment starting from 4D v11 and newer. Accent character is replaced by //

4ME

Normal 4ME

P:This is a commentout{hi!} This is also a comment# This is a Python-Like commentE:Anything after the "E:" command wont be executed

Rewriten 4ME

#this is the only posible comment as of now and it also can't be next to commands

6502 Assembly

Note: syntax depends on the assembler software but use of a semicolon is fairly standard

          nop           ; comments begin with a semicolon

68000 Assembly

Note: syntax depends on the assembler software but use of a semicolon is fairly standard

EASy68k uses * as the comment character. VASM uses a semicolon ;

MOVEM.LD0-D7/A0-A6,-(SP);push all registers onto the stack

8086 Assembly

Note: syntax depends on the assembler software but use of a semicolon is fairly standard

MOVAX,4C00h; go back to DOSINT21h; BIOS interrupt 21 base 16

AArch64 Assembly

Works with:as version Raspberry Pi 3B version Buster 64 bits
/* ARM assembly AARCH64 Raspberry PI 3B *//*  comments multi lines    end comments    */               // comment end of ligne

ACL2

Just like Common Lisp:

; Single line comment#| Multi-linecomment |#

Action!

Action! supports only single line comments which begin with semicolon.

;This is a commentPROC Main() ;This is a comment as wellRETURN
Output:

Screenshot from Atari 8-bit computer

ActionScript

SeeJava

Ada

-- All Ada comments begin with "--" and extend to the end of the line

Agena

Agena has single line comments and two styles of multi-line comments.

# single line comment#/ multi-line comment   - ends with the "/ followed by #" terminator on the next line/#/* multi-line comment - C-style   - ends with the "* followed by /" terminator on the next line*/

ALGOL 60

A comment in ALGOL 60 takes the place of a single instruction.

'COMMENT' this is a first comment;'COMMENT' ****** this is a second comment ******;

Any sequence fromEND to a semicolon or toELSE is considered a comment (not afterEND FINISH).

NOTE. A wrongly omitted semicolon afterEND is a frequent cause of errors. Even if syntax error is not raised, the following statement can be considered a comment and not executed.

ALGOL 68

With Standard

Comments can be inserted in variety of ways:

Algol68 as typically published,

includesbold typeface.

Quote stropping,

like toWiki markup.

Case stropping,

7-bit/ascii implementations.

Res stropping,

detecting reserved words.

Point stropping,

6-bits/byte implementations.

¢ The original way of adding your 2 cents worth to a program with the "cent" character ¢¢ TEXT ¢
co Style i commentco

comment textcomment

'co' text 'co'

'comment' text 'comment'

CO text CO

COMMENT text COMMENT

co text co

comment text comment

.CO TEXT .CO

.COMMENT TEXT .COMMENT

# Style ii comment with the hash character ## TEXT #

Notes:

  • The# test # and¢ text ¢ comment tends to be used for inline comments. And theCOMMENT text COMMENT style tends to be used to comment out entire blocks.
  • The scriptalgol68.vim can be used to highlight commented blocks while editing source code.

With Extensions

£ This is a hash/pound comment for a UK keyboard £

ALGOL-M

begincomment - This form is borrowed from ALGOL 60;% And this is borrowed from ALGOL W %% ALGOL-M will not compile an "empty" program, so we have %% to include at least one code-generating statement!      %write("This is only an exercise");end


ALGOL W

Comments in Algol W can appear anywhere whitespace is allowed. A comment starts with the reserved word 'comment' and ends with the next semi-colon. Alternatively a comment can start with a percent sign and end with the next percent sign or semi-colon.

A single word in the form of an identifier following the reserved word 'end' is also a comment.

begin    comment a comment;    % another comment    ;    % and      another    %end this_word_is_also_a_comment.

AmigaE

/* multiline commentare like C ... */-> this is a end of line comment

AngelScript

// This is a comment

AntLang

2 + 2 /This is a comment

Apex

System.debug ('I will execute');   // This comment is ignored./* I am a large comment, completely ignored as well.*/

APL

⍝ This is a comment

AppleScript

--This is a single line commentdisplay dialog"ok"--it can go at the end of a line# Hash style comments are also supported(* This is a multiline comment*)(* This is a comment. --comments can be nested  (* Nested block comment *)*)
Works with:AppleScript version 2.0
display dialog"ok"#Starting in version 2.0, end-line comments can begin with a hash

Arendelle

Arendelle uses C style comments

ArkScript

# this is a comment# another comment# with another below

ARM Assembly

Works with:as version Raspberry Pi
/* ARM assembly Raspberry PI comment one line *//*  comment line 1    comment line 2*/ mov r0,#0    @ this comment on end of linemov r1,#0    //  authorized comment

Arturo

; This is a simple single-line commenta:10; another single-line comment; Now, this is a; multi-line comment

Asymptote

// double slash to newline

Seeprogramming introduction in the Asymptote manual.

When reading data files a comment character in them can be specified ascomment="#" etc. SeeFiles in the Asymptote manual.

AutoHotkey

Msgbox,commentsdemo ; end of line comment/*multiline comment1multiline comment2*/

For multi-line comments, the/* and*/must be on their own separate lines. Nothing else can be on the same line.

AutoIt

#csEverything between the cs and and the ce is commented.Commented code is not used by the computer.#ce;individual lines after a semicolon are commented.

AWK

Thehash symbol # start a comment; it ends at the end of line.

BEGIN{# this code does something# do something}

Axe

.This is a single-line comment
...This is a multi-line comment...
...If 0This is a comment only if the condition evaluates to zero...
...!If 1This is a comment only if the condition evaluates to nonzero...
...ElseThis is a comment only if the previous conditional comment was executed (and vice versa)...

Babel

-- This is a line-comment#    This is a block-comment    It goes until de-dentdedent: 0x42 -- The comment block above is now closed

Ballerina

Ballerina has single line comments (starting with //) and documentation comments (starting with #). Multi-line comments are not supported.

// This is a single-line commentintx=10;// This is an inline comment#Representsauserrecord.typeUserrecord{#User'sID.intid;#User'sname.stringname;};

BASIC

Works with:Applesoft BASIC
Works with:Commodore BASIC
Works with:Extended Color BASIC
Works with:GW-BASIC
Works with:ZX Spectrum Basic
Works with:uBasic/4tH

The only truly standard method of marking a comment in BASIC is using theREM keyword. This dates back to (at least) the late 1970's, andshould work with most BASICs available today:

100REM Standard BASIC comments begin with "REM" (remark) and extend to the end of the line110PRINT"this is code":REMcommentafterstatement
Works with:Applesoft BASIC

This may not be well known, but you may include text after the line number of GOTO and GOSUB statements. This is kind of a comment in absence of labels.

100  GOTO 200HERE                      110  GOSUB 300THERE                    120  GOTO 400THEOTHERPLACE             130  GOTO 500MOM AND  POP

Spaces are removed from non-keyword text. BASIC keywords can be used. List outputs spaces around keywords.

Works with:QBasic version 1.1
Works with:QuickBASIC version 4.5
Works with:uBasic/4tH

Most BASICs also support alternate comment characters, commonly an apostrophe (single quote):

'this is a commentPRINT"this is code"'comment after statement
Works with:DarkBASIC

Characters other than apostrophe are used in some BASICs. For example, DarkBASIC uses a back-tick character (`, a.k.a.grave accent):

`this is a commentPRINT "this is code" `comment after statement'this is NOT a comment!
Works with:FreeBASIC version 0.16 or later

In addition to single-line comments, a few BASICs support block comments. FreeBASIC was influenced bythe C family's block comment characters:

/' This is a multi line comment.Requires FreeBASIC 0.16 or later.Last line of the comment block. '/DIM a AS /' Comment in the middle of statement '/ Integer

Applesoft BASIC

Comment by making a REMark using the REM keyword

REM COMMENT AFTER THE REM KEYWORD

When LISTing the program a space is added after the REM keyword

0REMLEAVETHESPACEOUTAFTERTHEREMWHENTYPINGORPASTING

The remark extends until the end of the line. Only the first THIS IS CODE is printed.

10PRINT"THIS IS CODE":REM:PRINT"THIS IS CODE"

A comment can come after a GOSUB and when the subroutine returns it continues running the statements after the GOSUB comment.

20GOSUB110COMMENT:PRINT"THIS IS CODE"

Anything after a GOTO or RETURN statement is ignored.

30GOTO40"COMMENT:THISISACOMMENT

There are other ways to add spacing and comments to code.

::::::::::::::::::::::::::::::::::::::40REM50:60REM<ctrl>+J70FORI=1to1080::::PRINTI;MID$("THIS IS A COMMENT",1,0)90NEXT

Typing CONTinue after the program ENDs will result in a ?SYNTAX ERROR.

100END:THISISACOMMENT

Use the quotation symbol " before the comment so that spaces are included and keywords are ignored.

110RETURN:"COMMENTFORANDATTHEEND

BaCon

BaCon acceptsREM (or single quote apostrophe) for line comments.

C-style block comments can be used with /* and */ pairs; these comment blocks may cross line boundaries.

InsideUSEC sections, all comment styles accepted by the configured C compiler will also be ignored.

BASIC256

rem this is a comment# and this is tooprint "this is code"  #comment after statement

Chipmunk Basic

Works with:Chipmunk Basic version 3.6.4
10remthisisacomment20' and this is too30print"this is code":'comment after statement40print"and more code":remcommentafterstatement

IS-BASIC

100 REM Standard BASIC comments begin with "REM" (remark) and extend to the end of the line110 PRINT "this is code" ! comment after statement

Minimal BASIC

10REM STANDARD BASIC COMMENTS BEGIN WITH "REM" AND EXTEND TO THE END OF LINE20END

MSX Basic

10remthisisacomment20' and this is too30print"this is code":'[:] it's optional40print"and more code":remcommentafterstatement

Quite BASIC

10remthisisacomment20print"this is code":remcommentafterstatement

True BASIC

!thisisacommentPRINT"this is code"!commentafterstatement

XBasic

Works with:Windows XBasic
Works with:Linux XBasic
PROGRAM"Comments"VERSION"0.0000"DECLAREFUNCTIONEntry()FUNCTIONEntry()'this is a commentPRINT"this is code"'comment after statementENDFUNCTIONENDPROGRAM

Yabasic

rem  Hey, this is a comment#    the hash-sign too (at beginning of line)// even the double slash' and the single quote (at beginning of line)print "Not a comment" #    This is an error !!print "Not a comment"://   But this is again a valid commentprint "Not a comment" //   even this.print "Not a comment" rem  and this !

Batch File

rem Single-line comment.

There is another (undocumented) option, using a double-colon::. However, this has issues with some syntactic constructs and therefore may raise syntax errors.

:: Another option, though undocumented and known:: to fail in some cases. Best avoided.

Yet another (undocumented) option, using (not delayed) variable expansion as long as it is undefined. This works because undefined variables result to blank line when expanded using%.

% this works as long as you have no variable named exactly like this sentence. %

Since comment lines are skipped entirely by the parser, multi-line comments aren't possible even with line continuation.

BBC BASIC

REM This is a comment which is ignored by the compiler*|Thisisacommentwhichiscompiledbutignoredatruntime

bc

/* This is a comment. */2+/* Comment between tokens. */3"This is a string, /* NOT a comment */."/* * A comment can have multiple lines. These asterisks in the middle * of the comment are only for style. You must not nest a comment * inside another comment; the first asterisk-slash ends the comment. */

Works with:GNU bc
Works with:OpenBSD bc
#!/usr/bin/bc# This form of comment is an extension, not part of standard bc.# Your program must not have a #! shebang line# unless your bc supports this form of comment.2+3  # It can be after a statement.a=1  # The newline is not part of the comment.b=2  # So this line is a different statement.

Beef

//This is a comment.//This is another comment./* This is also a comment. *//* This is amulti-linecomment */

The IDE allows for documenting types and methods with /// or /** */ (which one of these you use doesn’t matter). Autocomplete suggestions, as well as prompts while calling/using the documented types or functions, will display their documentation.


static{/// Must be placed directly above the method, including attributes./// Using multiple lines like this is also fine. Both will be recognized.[Optimize]publicstaticvoidDoAThing(){}/// Documentation also works for types.structSomeStruct{/**        * Multiline comment with two ** at the start works in the same way.        */voidPrivateMethod(){}}/**    * If you have a really long explainer here, you may not actually want to show that in autcompletion prompts.    * @brief Allows you to select only this line to be shown.    *    * @param a This is shown when writing a call to this function and placing parameter "a".    * @param b For the second argument, the documentation for b (this!) will show up instead.    */publicstaticvoidDoAnotherThing(inta,intb){}}

Befunge

Like Brainf***, all characters and whitespace which are not commands are ignored. Also, since the code/data-space is two-dimensional, comments can be placed anywhere that will be untouched by the instruction pointer and data access commands.Finally, in Funge-98, the ; instruction immediately skips to the next ; instruction, which allows to isolate comments from code.

Works with:Befunge version 93
&readanumber2+addtwo.@displayresultandexit^-inlinecomments-^<-^-othercomments
Works with:Befunge version 98
&;readanumber;2+;addtwo;.@;displayresultandexit;^-inlinecomments-^<-^-othercomments;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;completelyisolatedcommentblockfortheparanoid;;(almost-youcanstillskipintoit.);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Binary Lambda Calculus

BLC has no notion of comments, but since input is considered part of the program, one can always ignore the remainder of input, which can thus be arbitrary. Of course one can have comments in any language that translates to BLC, as discussed inhttps://rosettacode.org/wiki/Documentation#Binary_Lambda_Calculus

Blast

# A hash symbol at the beginning of a line marks the line as a comment

BQN

# This is a comment

Bracmat

Bracmat uses curly braces as comment delimiters. Curly braces inside comments must be balanced. Comments are so much ignored when source code is read, that they do not reappear in listings created by the built-inlst$ function, an otherwise very useful function to autoindent your code.

Brainf***

This is a comment

Most ASCII characters may be used for comments; only the eight characters "+-<>[],." are Brainf*** commands. Extra care must be used when using punctuation, particularly the comma or period. These are I/O operators and are actually commands rather than comments, and are instead compiled into the program if used and may have to be "debugged" and removed if you forget this issue. Another workaround for this issue is to tactically place the comment inside a "[]" loop which can never be entered (The loop will only be encountered when the active memory cell value is 0).

Brat

# Single line comment#* Multi   Line   Comment *#

Bruijn

Bruijn does not have multi-line comments.

# This is a comment

Brlcad

 # Comments in mget scripts are prefixed with a hash symbol ls   # comments may appear at the end of a line

Burlesque

Burlesque does NOT have comments. However, you can comment code by pushing a string and popping it immediately.

"I'm sort of a comment"vv

Since strings are multi-line strings:

"I'm avery long comment spanningover several lines"vv

C

/* This is a comment. *//* So is this   multiline comment. */

The comment starts at the/*, and ends at the*/. A comment may be used between any tokens. It cannot be used inside tokens, that is, given the code

structcharisma{};voidf(char/* comment */isma){}

the function takes an argument of type char, named isma, not an unnamed argument of type charisma.

Comments cannot be nested; that is, if you write

/* some comment /* trying to nest some other comment */inside*/

the comment ends at the first*/, andinside */ is again interpreted as source code (almost certainly causing a compile error). Some compilers have the option to allow nested comments, but this is not a standard feature.

Conditional compilation also can be used to make the compiler ignore some text:

#if 0While technically not a comment, this is also ignored by the compiler#endif

The trick is that 0 is always false, therefore the text between#if 0 and#endif is never compiled. While this should never be used for actual comments, it's an easy way to comment out some code, especially because it doesn't interfere with normal (documentation) comments.

Conditional compile "comments" can be nested:

#ifdef UNDEFINEDThisisnotcompiled.#if 0Nor is this.#endifAndthisstillisnotcompiled.#endif
Works with:ANSI

Even though the compiler doesn't see#if 0 text, the preprocessor does. Therefore some minimal rules still have to be followed. For example, the following code isnot valid:

#if 0This isn't valid.#endif

That's because the preprocessor will interpret the apostrophe as beginning of a character constant, and will complain because that character constant isn't terminated with another apostrophe.

Note that the problem mentioned above cannot occur if there's valid code between the#if 0 and#endif.

Works with:C99
// C++ single-line comments were adopted in the C99 standard.

C#

//This is a comment.//This is other comment./* This is a comment too. *//* This is amulti-linecomment */

C++

See alsoC

Single line C++-style comments

// This is a comment

C++-style comments start with// and reach up to, but not including, the end of line (more exactly, up to the next unescaped newline). While formally, C++-style comments cannot be nested either, in practice they can:

// This is a valid comment // with a "nested" comment

That's because starting with the first// everything in the line is ignored, including the second//.The fact that the newline isnot part of the comment is important for multi-line macro definitions. It means that in the code

#define FOO \  (macro text)// comment(nomoremacrotext)

the line(no more macro text) isnot part of the macro definition. Also escaping the line break at the end of the comment with '\' doesn't help, because that would make the third line part of thecomment instead. Comments inside macros therefore have to be C-style.

Chapel

// single line/* multiline */

Chef

Comment Stew.This is a comment.The other comment is a loop, but you can name it anything (single word only).You can also name ingredients as commentsThis is pseudocode.Ingredients.Ingredient listMethod.Methods.SingleWordCommentOne the Ingredient.Methods.SingleWordCommentTwo until SingleWordCommentOned.Methods.

ChucK

<-- Not common // Usual comment

Clean

Clean comments are similar to C++.

Start=/* This is a multi-           line comment     */17// This is a single-line comment

In contrast to C++ comments can be nested.

Start=/* This is a comment /* Nested comment */ still a comment */17

Clojure

Anything from a semicolon to the end of a line is a comment.

;; This is a comment(defnfoo[]123); also a comment

The(comment) macro will prevent a form from being evaluated, returningnil no matter what is contained in the comment. However the forms inside thecomment form must be properly parseable (parentheses balanced, etc.) or an exception will be thrown.

(comment(println(foo))"bar":baz123(System/exit0));; does nothing, returns nil

Finally, the#_ reader macro will cause a form to be ignored by the reader. Unlike(comment), this does not returnnil; the surrounding code is evaluated as though the ignored form isn't even there.

(+1(comment"foo")3);; Throws an exception, because it tries to add nil to an integer(+1#_"foo"3);; Returns 4

CMake

Line comments use the common# syntax:

# A single-line comment

Multi-line comments use a Lua-like square-bracket syntax.

#[[A multi-line   comment ]]#[==[A multi-line comment     with [[nested brackets]]. ]==]

The number of equals signs (=) in the opening bracket determines the number expected in the closing bracket.

COBOL

Fixed format

      * an asterisk in 7th column comments the line out

A D in the 7th column indicates a debugging line which is treated like a comment unless a compiler flag is set.

DDISPLAY"Debug"

Free format

*> Thiscommentsyntaxwasdefined(withfreeformatcode)inCOBOL2002.
Works with:GnuCOBOL

This indicates a debugging line like above, but if it is used in fixed format files, it must be in the 8th column or beyond.Not necessarily. GnuCOBOL also supports D as an indicator in column 7, the >>D format works (more by trickery than spec) if the angle brackets start in column 5, the D ending up in column 7. The >>D debug marker can then be both fixed and free form compatible.

>>D DISPLAY"Debug"

NOTE statement

Works with:OS/VS COBOL

This statement causes everything following it up to the next separator period to be treated as a comment. This statement was deleted in COBOL-74.

NOTEthisparagraphiscommentedoutandignored.

REMARKS and other statements

Works with:GnuCOBOL

There are quite a fewIDENTIFICATION DIVISION obsolete and extension reserved words that will work in GnuCOBOL 2.

IDENTIFICATIONDIVISION.PROGRAM-ID.program.AUTHOR.Restoflineignored.REMARKS.Restoflineignored.REMARKS.Moreremarks.SECURITY.lineignored.INSTALLATION.lineignored.DATE-WRITTEN.same,humanreadabledatesareallowedforinstanceDATE-COMPILED.same.DATE-MODIFIED.thisoneishandywhenauto-stampedbyaneditor.

Those lines can occur multiple times each within the IDENTIFICATION DIVISION. There can be many AUTHORs, SECURITY notes, etc. These words are also supported by other COBOL dialects, but may have different rules on order, multiples allowed of if full stop periods are required (or allowed) before the end of line.

CoffeeScript

# one line comment### multilinecomment ###

ColdFusion

In tags:

As ColdFusion's grammar is based around HTML syntax, commenting is similar to HTML.<!--- This is a comment.  Nothing in this tag can be seen by the end user.       Note the three-or-greater dashes to open and close the tag. ---><!--  This is an HTML comment.  Any HTML between the opening and closing of the tag will be ignored, but any ColdFusion code will still run.       Note that in the popular FuseBox framework for ColdFusion, the circuit.xml files require that you use this style of comment. -->

In script:

/* This is a comment */// This is also a comment

Common Lisp

Common Lisp providesline comments (;) andblock comments (#|...|#).

Block comments can nest (#|...#|...|#...|#), unlike block comments in e.g.C.

In a common convention, header comments are prefaced with four semicolons, top-level (function level) comments use three, comments for sections of code use two, and margin comments use one.

;;;; This code implements the foo and bar functions;;; The foo function calls bar on the first argument and multiplies the result by the second.;;; The arguments are two integers(defunfoo(ab);; Call bar and multiply(*(bara); Calling barb));;; The bar function simply adds 3 to the argument(defunbar(n)(+n3))

However, comments should not be used for inline documentation, as most defining constructs permit a documentation string (which is then available at runtime).

(defunbar(n)"Add 3 to the argument."(+n3))(defclassbutton(widget)(labelaction)(:documentation"This is a push-button widget."))

Component Pascal

(* Comments (* can nest *)andtheycanspanmultiplelines.*)

Crystal

# currently, Crystal only supports single-line comments# This is a doc comment. Any line *directly* above (no blank lines) a module, class, or method is considered a doc comment# Doc comments are used to generate documentation with `crystal docs`classFooend

D

voidmain(){// A single line comment./* This is a simple C-style comment that can't be nested.    Comments mostly work similar to C, newlines are irrelevant.    *//+ This is a nestable comment      /+ See?      +/    +//// Documentation single line comment./**    Simple C-style documentation comment.    *//++    Nestable documenttion comment.    +/}

Dart

// This is a single line comment, which lasts until the end of the line. The Dart linter prefers this one./* This is also a valid single line comment. Unlike the first one, this one terminates after one of these -> *//*  You can use the syntax above to make multi line comments as well.  Like this!*//// These are doc comments. You can use dartdoc to generate doc pages for your classes with these.////// Formatting [variable] and [function] names like so allows dartdoc to link to the documentation for those entities.

dc

There is no comment syntax in POSIX dc. The convention is to make a string on the stack and move it to an unused register; a no-op.

[Making and discarding a string acts like a comment] sz

GNU dc added the comment syntax of many other scripting languages.

# remainder of line is a comment

Delphi

See alsoPascal

In addition to Pascal, Delphi also allows C++ style single line comments:

// single line comment

Deluge

Comments are only allowed in places such as "on load" scripts. You cannot put them in form or view definitions.

// single line comment

DuckDB

Works with:DuckDB version V1.1
Works with:DuckDB version V1.0

DuckDB ahheres to SQL conventions about `--` comments -- see#SQL below.Of course, when the pair `--` occurs within a quoted string it is recognized as part of the string.

The DuckDB CLI (command-line interpreter) also supports '#' comments and /* ... */' commentsin the usual way, but '#' comments cannot appear on lines that are part of an SQL statement.

Here's an illustrative typescript, where "D " signifies the DuckDB prompt.

D SELECT '--';┌─────────┐│  '--'   ││ varchar │├─────────┤│ --      │└─────────┘D # This line is ignored.D select 1; -- This comment is ignored.┌───────┐│   1   ││ int32 │├───────┤│     1 │└───────┘D /* Block comment begins here.· Notice the continuation mark at the beginning of· And now back to D. */D select /* Hello ducks. */ 1;┌───────┐│   1   ││ int32 │├───────┤│     1 │└───────┘


Dragon

// This is a comment
/*  This is  a multiple  line comment. */
showln "Hello " /* This is an inline comment */ "world"

Dragonstone

#[    Multi-Line Comment.]##[    Nested Multi-Line Comment.    #[        Inner comment.        #[            It can go deep.        ]#    ]#    Outer comment.]## Single Line Comment#[ Multi-Line Comment on line ]# message = "Hello!" #[ Inside or Outside ]#echo message  # Another Trailing Comment.

DWScript

(* This is a comment.   It may extend across multiple lines. *){ Alternatively curly braces  can be used. }/*C-stylemulti-linecommentsaresupported*/// and single-line C++ style comments too

Dyalect

/* This is amulti-line comment *///This is a single-line comment

Dylan

// This is a comment/*   This is a comment   that spans multiple   lines*/

Déjà Vu

#this is a comment!print "this is not a comment, obviously" #this is a comment as well

E

# This is a regular comment.? "This is an Updoc comment, which> is an executable example or test case.".split(" ")# value: ["This", "is", "an", "Updoc", "comment,", "which#        is", "an", "executable", "example", "or", "test", "case."]

All comments span to the end of the line; there are no paired-delimiter comment syntaxes. “#” begins a comment anywhere outside of quotes; “?” and “>” begin comments only if they are at the beginning of a line (except for whitespace), because those characters are also used for infix operators.

In Updoc, “?” indicates the beginning of a program fragment, “>” the continuation of one, and “#” begins the expected output from its evaluation; “??” indicates special directives.

EasyLang

# This is a comment

EchoLisp

666; this is an end-of-line comment#| This is a multi-line comment Nesting is not allowed|#;; The (info <name> [<string>)] function associates a symbol and a comment;; These info strings are saved in permanent memory (local storage);; Unicode characters may be used, as everywhere in the language(definemynumber666)mynumber(info'mynumber"👀 Symbols may be commented with an information string 👺")(info'mynumber)displaystheaboveinsidethe'info'field.

ECL

Single-line comments must begin with //

// this is a one-line comment

Block comments must be delimited with /* and */

/* this is a block comment - the terminator can be on the same lineor any succeeding line – everything in between is ignored */

Ecstasy

Comments in Ecstasy follow the two forms used by most C-family languages:

/* * This is a multi-line comment. */Inti=0;// This is an end-of-line comment

ed

# A single-line comment.# The only type of comment, really.# No block comments in ed

EDSAC order code

EDSAC programs were handwritten on "programme sheets" designed for the purpose. The programmer, or a computer operator, then copied the "orders" (instructions) to punched tape for input to the machine. Programme sheets had a column for "notes" (comments), but these were not copied to the tape.Modern simulators, however, accept square brackets as comment delimiters.

[This is a comment][And soisthis][But in 1949 they wouldn't have been]

EGL

SeeJava

Eiffel

-- inline comment, continues until new line

Ela

//single line comment/*multiple linecomment*/

Elena

//single line comment/*multiple linecomment*/

Elixir

Elixir does not have multiple line comments.

# single line comment

Elm

-- a single line comment{- a multiline comment   {- can be nested -}-}

Emacs Lisp

A comment is started by; and reaches to the end of the line.

; This is a comment

There are some coding conventions for;; align to indentation,;;; sections, etc,

http://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html

Another way to add comments is to use strings at places where the result of an expression is ignored, since they simply evaluate to themselves without any effect. Note that strings can be multi-line:

"This is effectively a comment,if used at a place where the result is ignored"

Note that strings at the beginning of function definitions are interpreted as documentation strings for the function (i.e. Emacs will display them if asked for help about the function), e.g.

(defunsubtract-second-from-first(xy)"This function subtracts its second argument from its first argument."(-yx))

Due to this, it's debatable if the string at that place can be considered as comment.

EMal

# This is a line comment.^|This is a single line block comment.|^^| This is | a multi-line | block comment. |^^|This is a ^|nested|^ block comment.|^

Erlang

% Erlang comments begin with "%" and extend to the end of the line.

ERRE

! Standard ERRE comments begin with ! and extend to the end of the linePRINT("this is code") ! comment after statement

Euphoria

Single line comment:

-- This is a comment


Multiline C-style comment:

/*This is a comment*/
Works with:Euphoria version 4.0.0

F#

F# accepts C++ type line comments and OCaml type block comments

// this comments to the end of the line(* this comments a region   which can be multi-line *)

Factor

! Comments starts with "! "#! Or with "#! "! and last until the end of the lineUSE:multiline/* The multiline vocabulary implements   C-like multiline comments. */

Falcon

Falcon supports C-language style single line and block comments. A single line comment begins with two slashes (//) and ends at the end of the line. A block comment begins with a slash followed by an asterisk, and terminates when an asterisk followed by a slash is met (/*...*/).

/* Start comment block My Life Story */// set up my bank account totalbank_account_total = 1000000 // Wish this was the case

FALSE

{comments are in curly braces}

Fancy

# Comments starts with "#"# and last until the end of the line

Fennel

; This is a single-line comment

Fermat

Function Foo(n) =     {Comments within a function are enclosed within curly brackets.}    {You can make multi-line comments        such as this one.}    n:=n^2 + 3n - 222;   {Comments can go after a semicolon.}    n:=n+1;    n.; comments between functions are preceded by semicolons, like thisFunction Bar(n) =    2n-1.

Fish

Since ><> is a funge-like language, all characters not touched by the command pointer or modified by thep andg commands can be comments.Unlike Brainf***, unknown commands are not ignored by the compiler, they just raise an error.

v This is the Fish version of the Integer sequence task>0>:n1+v all comments here^o" "< still hereAnd of course here :)

Forth

Standard Forth includes a number of ways to add comment text. As with everything in Forth, comment characters are actually words that control the compiler.

\ The backslash skips everything else on the line( The left paren skips everything up to the next right paren on the same line)

Traditionally, the paren comments are used for "stack effect" notation:

:myword( a b -- c )...

This comment means "myword takes two cells on the stack and leaves one". Sometimes, stack effect comment names give clues about the word's function:

:add'em( a b -- a+b )+;:strlen( addr -- len )countnip;

Some Forth systems implement other commenting words, such as these words from Win32Forth:

\s skips all remaining text in the file(( skips until the next double-paren,    stretching across multiple lines ))comment:   Ignore all text in this sectioncomment;doc   Another comment blockenddoc/* C-style comment */(* Pascal-style comment *)


Fortran

Compiler: ANSI FORTRAN 77 or compatible (likeg77 -strict)

The first six columns in Fortran are traditionally reserved for labels and certain special characters. In particular the letter "C" in the first column indicates a comment:

C     This would be some kind of commentC     Usually one would avoid columns 2-6 even in a comment.

Some Fortran compilers have the extension that comments starting with D are treated as non-comments if a special debugging flag is given at the compiler invocation. For example:

C     If compiled in debugging mode, print the current value of ID     PRINT *, I

ISO Fortran 90 or later have an inline comment (!) syntax:

real :: a = 0.0   ! initialize A to be zero

In ISO Fortran 90 or later, "C in first column" comments are only allowed in the "fixed" source form familiar to FORTRAN 77 programmers. The "free" source form only has inline comments (!).

ISO Fortran 95 or later has an optional conditional compilation syntax. If present, it can be used (abused?) to (in effect) comment out blocks of code:

?? if (.false.) thendo while (oh_no)   a = bad_news()   b = big_mistake()   c = gigo()end do?? end if

FreeBASIC

' FB 1.05.0 Win64' This a single line commentREM This is another way of writing a single line comment/'   This is a  multi-line  comment'//'   Multi-line comments  /'    can also be nested  '/  like this'/


Frink

// This is a single-line comment/*  This is a comment    that spans multiple lines    and so on.*/

Futhark

-- Single-line comment-- Multi-line-- comment (yes, just several single-line comments).

FutureBasic

//  Single line commentrem Single line comment/*  Single line comment  *//*  Multiline  comment*/

FUZE BASIC

//Comment (No space required)# Comment (Space required)REM Comment (Space require)PRINT "This is an inline comment."//Comment (No space required)END

Gambas

In gambas, comments can be inserted by prefixing them with an apostrophe. The gambas interpreter will ignore the apostrophe and any other characters that follow it until the end of the line:

 ' This whole line is a comment and is ignored by the gambas interpreter print "Hello" ' Comments after an apostrophe are ignored '' A bold-style comment ' TODO:  To Do  comment will appear in Task Bar ' FIXME: Fix Me comment will appear in Task Bar ' NOTE:  Note   commnet will appear in Task Bar

GAP

# Comment (till end of line)

gecho

( this is a test comment... o.O ) 1 2 + .

Gema

! comment starts with "!" and continues to end of line

A shebang (#!) may be used as a comment in the first line of a file.

Genie

Genie allows comments in code in two different ways.

// Comment continues until end of line/* Comment lasts between delimiters */

Delimited comments cannot be nested.

GML

single-line comment:

 // comment starts with "//" and continues to the end of the line

multi-line comment:

 /* a multi-line comment starts with slash-asterisk and,ends with asterisk-slash.also note: * A multi-line comment is ignored inside a string * A multi-line comment can be ended inside a line*/

gnuplot

# this is a comment# backslash continues \a comment to the next \line or lines

The way backslash continues a comment means that comments can't usefully be put within a multi-line function definition,

# this doesn't workfoo(n) = (n                \          + 2    # no good \          + 3)          # behaves as if you wrote merelyfoo(n) = (n+2

Go

// this is a single line comment/* this is   a multi-line   block comment./* It does not nest */

Golfscript

# end of line comment

Gri

# through to newline.

# this is a commentshow 123        # this too is a comment

// works similarly but is reckoned the "old way" (as of Gri 2.12.23)

// this is a commentshow 123        // this too is a comment

Both forms can be used in input data files too.

Groovy

SeeJava

GW-BASIC

Works with:GW-BASIC
100 REM Standard BASIC comments begin with "REM" (remark) and extend to the end of the line110 PRINT "this is code": REM comment after statement

Haskell

i code = True -- I am a comment.{- I am also   a comment. {-comments can be nested-}   let u x = x x (this code not compiled)   Are you? -}-- |This is a Haddock documentation comment for the following codei code = True-- ^This is a Haddock documentation comment for the preceding code{-|  This is a Haddock documentation block comment-}i code = True

Haxe

// Single line commment./*    Multiple   line   comment.*/

HicEst

! a comment starts with a "!" and ends at the end of the line

Hope

! All Hope comments begin with "!" and extend to the end of the line

HTML

<!-- Anything within these bracket tags is commented, single or multi-line. -->

Icon andUnicon

Any text after "#" is a comment.

# This is a commentprocedure x(y,z)    #: This is a comment and an IPL meta-comment for a procedure

TheThe Icon Programming Library established conventions for commenting library additions and functions. This included both header block comments and meta comments on procedures within library files.

IDL

The comment character in IDL is the semicolon - everything starting with it and to the end of the line is a comment. Like this:

; The following computes the factorial of a number "n"fact = product(indgen( n )+1) ; where n should be an integer

Idris

(according to Gemini AI):Idris2 uses comment characters similar to Haskell:Single-line comments: Start with -- (two hyphens). Everything from -- to the end of the line is a comment.Multi-line comments: Enclosed by {- and -}. These can span multiple lines and can also be nested.Additionally, Idris2 supports inline documentation comments which begin with ||| (three pipe symbols). These are parsed by the compiler and can be used to generate documentation.

Inform 7

[This is a single-line comment.][This is amulti-line comment.][Comments can [be nested].]

Insitux

;this is a comment; and using semicolons here is fine(+ 2 2) ;this is a comment"this string will be ignored if in the top scopewhich can also stretch acrossmultiple lines"(do "if you're desperate, using do will make sure this string will not be returned also"  (+ 2 2))

Intercal

PLEASE NOTE This is a comment

Io

# Single-line comment// Single-line comment/* Multi-line   comment */

Isabelle

theory Textimports Mainbegin(* Top-level Isar comment. *)end

J

NB. Text that follows 'NB.' has no effect on execution.'Character strings in J may have their value be ignored and treated as comment text.'0 : 0Multi-line comments may be placed in strings,like this.)Note 'example'Another way to record multi-line comments as text is to use 'Note', which is actuallya simple program that makes it clearer when defined text is used only to provide comment.){{)n  J release 9's nestable blocks can be used as comments.  Typically, this would be in contexts where the blocks would not be used.  That said, "literate coding practices" may stretch the boundaries here.  Also, noun blocks (beginning with ')n') avoid syntactic concerns about content.  These blocks even allow contained '}}' sequences to be ignored (unless, of  course the }} character pair appears at the beginning of a line).}}

Janet

(according to Gemini AI):The Janet programming language uses the # character for comments.Single-line comments: Everything from # to the end of the line is treated as a comment.Janet does not have built-in multi-line comments in the same way some other languages do (like {- ... -} in Idris2 or /* ... */ in C-like languages). However, because Janet is expression-oriented, you can often use multi-line strings as a form of "comment" if you put them in a context where their value isn't used.

Java

Java has two ways to enter normal comments, plus a third type of comment that doubles as a way to generate HTML documentation.

C Style

/* This is a comment */
/* * This is * a multiple * line comment. */

ThisC-style comment starts with/* and ends with*/.The two delimiters may be on the same or separate lines.This style comment may be used anywhere white space is permitted.

C++ Style (inline)

// This is a comment

ThisC++-style comment starts with// and extends to the end of line.

Java Documentation (Javadoc)

/** This is a Javadoc comment */
/** * This is * a multiple * line Javadoc comment */

Javadoc is a standardized documentation code for Java. Its comments begin with a forward slash and two stars. Javadoc comments have different tags that signify different things in the methods and classes that they precede.

Sneaky

Your editor will probably colour this as great big comment, but it compiles and prints "Hello World!". Once you've figured out how this works, try thisdiscussion on why it's allowed.

public class JustComments {    /*    \u002A\u002F\u0070\u0075\u0062\u006C\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063    \u0020\u0076\u006F\u0069\u0064\u0020\u006D\u0061\u0069\u006E\u0028    \u0053\u0074\u0072\u0069\u006E\u0067\u005B\u005D\u0061\u0072\u0067\u0073\u0029    \u007B\u0053\u0079\u0073\u0074\u0065\u006D\u002E\u006F\u0075\u0074\u002E    \u0070\u0072\u0069\u006E\u0074\u006C\u006E\u0028\u0022\u0048\u0065\u006C\u006C\u006F\u0022    \u002B\u0022\u0020\u0057\u006F\u0072\u006C\u0064\u0021\u0022\u0029\u003B\u007D\u002F\u002A    */}

JavaScript

n = n + 1; // This is a comment
// This is a valid comment // with a "nested" comment
/* This isa multi linecomment// with a "nested" commentand another line in the comment*/

JCL

first form

//* This is a comment line (//* in columns 1-3)

second form

/* This is also a comment line (/*  in columns 1-3)

Joy

# this is a single line comment(* this is amulti-line comment *)

Multi-line comments cannot be nested.

jq

Except when a hash symbol (#) appears within a string, it begins a comment that continues to the end of the line:

# this is a single line comment"Hello #world" # the first # on this line is part of the jq program

Jsish

#!/usr/bin/env/jsish/* Comments, in Jsish */// to end of line comment, double slash/* Enclosed comment, slash star, ending with star slash Cannot be nested, but can cross line boundaries and occur pretty much anywhere whitespace is allowed*/var x = 'X'; /* A var called X *//* active code on this line */ printf("Result %q %d\n", /* comment code mix */ x, /**/42);;x;// jsish also handles double slash commented// unit test echo lines as a special case of "expect failure";//noname(x);/*=!EXPECTSTART!=Result X 42x ==> Xnoname(x) ==>PASS!: err = can not execute expression: 'noname' not a function=!EXPECTEND!=*/
Output:
prompt$ jsish comments.jsiResult X 42prompt$ jsish --U comments.jsiResult X 42x ==> Xnoname(x) ==>PASS!: err = can not execute expression: 'noname' not a functionprompt$ jsish -u comments.jsi[PASS] comments.jsi

Julia

# single line#=Multi-linecomment=#

K

  / this is a comment  2+2  / as is this

KonsolScript

//This is a comment.//This is another comment./* This is a comment too. *//* This is a multi-linecomment */

Kotlin

// This is a single line comment/*    This is a     multi-line    comment*//*    Multi-line comments    /*        can also be nested    */    like so*/const val CURRENT_VERSION = "1.0.5-2"  // A comment can also be added at the end of a lineconst val /* or even in the middle of a line */ NEXT_MAJOR_VERSION = "1.1"/** * This is a documentation comment used by KDoc. * * It's documenting the main function which is the entry-point to a Kotlin executable. * * @param [args] A string array containing the command line arguments (if any) passed to the executable * @return Implicit return value is Unit which signifies no meaningful return value (like 'void' in java) */fun main(args: Array<String>) {    println("Current stable version is $CURRENT_VERSION")    println("Next major version is $NEXT_MAJOR_VERSION")}

Lambdatalk

Out of bracketed expressions words are ignored by the lambdatalk evaluator and are dislayed as they are:Hello World-> Hello WorldIn order to prevent any evaluation and display of some parts of code put them inside triple degrees "°°°": °°°this is   a comment ... and an expression {+ 1 2}     on several lines°°°

LabVIEW

This image is aVI Snippet, an executable image ofLabVIEW code. The LabVIEW version is shown on the top-right hand corner. You can download it, then drag-and-drop it onto the LabVIEW block diagram from a file browser, and it will appear as runnable, editable code.

Lang

Single line

# This is a comment

Multiline (Line continuation)

# This is a comment\with multiple lines

Multiline (Multiline text sequence)

# {{{This is a commentwhich has more than2 linesand this one}}}

Lang5

# This is a comment.

langur

Langur has 2 types of comments.

# single line comment starts with hash mark/* inline or multi-line comment uses C-style syntax */

Lasso

//This is a comment./* This is also a comment. *//* A multi-linecomment *//* ==========================A multi-linecomment =========================== */

LaTeX

In LaTeX, comments look like this:

\documentclass{minimal}\begin{document}% This is a comment\end{document}

LaTeX comments start with% and continue up toand including the line break. The fact that the line break itself is commented out as well makes it useful for adding line breaks in the source code of complex macros without LaTeX interpreting them (which may cause extra space or even a paragraph break in the resulting typeset text). For example, the following results in theone word "understandable":

\documentclass{minimal}\newcommand{\firstpart}[1]{under#1}\newcommand{\secondpart}{able}\newcommand{\complete}{%\firstpart{stand}%\secondpart}\begin{document}\complete\end{document}

Without the percent sign after\firstpart{stand}, it would have been thetwo words "understand able".

Liberty BASIC

'This is a commentREM This is a commentprint "This has a comment on the end of the line." 'This is a commentprint "This also has a comment on the end of the line." : REM This is a comment

Lily

There are two kinds of comments:

# This is a single-line comment

and

#[ Thisisablockcomment ]#

Like with C, block comments don't nest.

LilyPond

% This is a comment%{ This is a commentspanning several lines %}

Lingo

In Lingo any line starting with "--" is a comment and ignored by the interpreter.

-- This is a comment.-- This is another comment

LiveCode

-- comment may appear anywhere on line// comment may appear anywhere on line# comment may appear anywhere on line/*  this is a block comment thatmay span any number of lines */

Logo

; comments come after a semicolon, and last until the end of the line

Logtalk

% single-line comment; extends to the end of the line
/* multi-linecomment */

LOLCODE

OBTW This is amulti line commentTLDR
BTW This is a single line comment.

LotusScript

LotusScript has two ways to enter comments.

' This is a comment

Wherever the single quote (') is used, the rest of the line is treated as a comment and ignored. Multi-line comments would each need a single quote mark. This style of comment is usually used for making small in-line or single line comments.

%REMThis is a multi- line comment.%END REM

A%REM marker begins a comment block, and a%END REM marker ends the comment block. This style of comment is used for making longer multi-line comments, often at the beginning of a class, sub or function.

LSE

* Ceci est un commentaire qui prend fin quand la ligne se termine(* Ceci est un commentaire sur plusieurs lignescomme vous pouvez le voir puisqu'il s'étend surplusieurs lignes justement... *)(* Cette exemple est selon la revision LSE-2000 *)

LSE64

# single line comment (space after # is required)

The author of LSE64 comments the stack effect of words with header comments as follows:

# arg1 arg2 '''yields''' result|''nothing''

Lua

-- A single line comment--[[A multi-line     comment --]]
Works with:Lua version 5.1 and above
--[====[ A multi-line comment that can contain [[ many square brackets ]]]====]

M2000 Interpreter

Multiline commendREM { lines of code, or text }

Same line comment until end of line (can start immediate after a command: use ' or \ or //

Rem (form start of code line)

(:\ and \\ or \) in a name can exist only for Dir statement:

dir c:\thatfolder

is the same as

dir "c:\thatfolder"


Module Comments {Rem {Print "no print here"? "no print here either"}Rem : single line remark// single line\ single line' single line? "ok" : Rem : Print "not print - but code have syntax highlight" ? "ok" // single line - start without double colon? "ok" \ single line - start without double colonPrint "ok" ' single line}Comments

M4

eval(2*3)  # eval(2*3)  "#" and text after it aren't processed but passed alongdnl  this text completely disappears, including the new linedivert(-1)Everything diverted to -1 is processed but the output is discarded.A comment could take this form as long as no macro names are used.divert
Output:
6  # eval(2*3)  "#" and text after it aren't processed but passed along

dnl must be a separate word. An empty pair of quotescan separate it from preceding text if necessary

some text`'dnl then a deleted comment

changecom() can set a different character for#,

changecom(%)% now percent prevents macro expansion

In GNU m4 an emptychangecom() string means no such commenting char at all (but in BSD m4 means reset to the default#)

changecom()GNU m4 now no macro expansion suppression character at all

In GNU m4changecom() also takes separate start and end strings and they can be multi-character sequences, allowing for example C style,

changecom(/*,*/)/* GNU m4 now no macro expansion in C style comments */

Maple

x := 4: x; # Everything on this line, after this, is a comment.17; (* This   is   a multiline comment *) 23.4;
Output:
                               4                               17                              23.4

Mathematica /Wolfram Language

(*this is a comment*)

It can be used everywhere and nested if necessary:

If[a(*number 1*)<(* is smaller than number 2*) b, True (*return value (*bool true*)*), False (*return bool false*)]

evaluates to:

If[a < b, True, False]

MATLAB

%This is a comment%% Two percent signs and a space are called a cell divider

Maxima

/* Comment  /* Nested comment */*/

MAXScript

-- Two dashes precede a single line comment/* This is a   multi-line comment */

MBS

! A pling in a line starts a commentINT   n:=5   ! Comments can appear at the end of a line/* A comment block can also be defined using climbstar and starclimb symbols.   This allows comments to be stretched across several lines */


MEL

// This is a single line comment

Metafont

% this is "to-end-of-line" comment

Microsoft Small Basic

Microsoft Small Basic uses the quote symbol to mark it's comments. After placing a quote everything in that line will be ignored.

' This is a commenti = i + 1  ' You can also append comments to statements

min

Works with:min version 0.19.3
; this is a comment1 1 + ; add one and one together

MiniScript

MiniScript just has one kind of comment. They begin with two slashes, and extend to theend of a line. So you can put a comment either on a line by itself, or after a statement.

// How many roads must a man walk down?x =  6 * 7  // forty-two

Mirah

puts 'code' # I am a comment/* This is * a multiple * line comment */

MIPS Assembly

This is ultimately up to the assembler, but semicolons are typically the comment character for almost all assemblers.

;this is a commentli $t0,0x1234     ;this is also a comment

However, MARS and QTSPIM use the#.

# this is a commentli $t0,0x1234     # this is also a comment

mIRC Scripting Language

;Single Line Comment/*MultipleLineComment*/

Modula-2 /Modula-3

(* Modula-2/Modula-3 use the same style of comments *)(* ...and comments (* can nest *)   and they can span multiple lines. *)

Monte

# This comment goes to the end of the line/** This comment is multi-line.    Yes, it starts with a two stars    and ends with only one.    These should only be used for docstrings. */

MontiLang

/# This is a comment #//# comments can span multiple lines nested comments are not supported #/

MOO

"String literals are technically the only long-term comment format";// Some compilers will, however, compile // one-liners to string literals as well (and vice-versa)/* Classical C-style comments are removed entirely during compile */

Nanoquery

Comments in Nanoquery must be on a single line.

// this is a comment// this is also a comment

NATURAL

* This is a comment and extends to the end of the line

Neko

// Single line comment, of course!/*Multi line comment!*//**Documentation block<doc>can include XML parsed nodes between doc tags</doc>**/

Nemerle

// This comment goes up to the end of the line/* Thisisamultilinecomment */

NESL

% This is a comment. %

NetRexx

NetRexx supports block-comments and line comments. Block comments are started with a/* and terminated with a*/. Line comments follow a-- sequence anywhere on a line.NetRexx supports nested comments (seeREXX).

/* NetRexx comment block*/-- NetRexx line comment

NewLISP

A comment is started by; and reaches to the end of the line.

; This is a comment

Nim

# Nim supports single-line commentsvar x = 0 ## Documentation comments start with double hash characters.var y = 0 ## Documentation comments are a proper part of the syntax (they're not discarded by parser, and a real part of AST).#[There are also multi-line commentsEverything inside of #[]# is commented.]## You can also discard multiline statements:discard """This can be considered as a "comment" tooThis is multi-line"""

Nix

# This comment goes up to the end of the line/* Thisisamultilinecomment */

NSIS

# This is a comment that goes from the # to the end of the line.; This is a comment that goes from the ; to the end of the  /* This is a multi-linecomment */

Oberon-2 /Oberon-07

(* Oberon-07/Oberon-2 use the same style of comments as Modula-2: this is a comment *)(*    and this is a   multiline comment   (* with a nested comment *)*)

Objeck

#This is a comment.# This is other comment. #~ This is a comment too. ~# #~ This is a multi-linecomment ~#

Objective-C

SeeC

OCaml

(* This a comment   (* containing nested comment *) *)(** This an OCamldoc documentation comment *)

Octave

# I am a comment till the end of line% I am a comment till the end of line%{  This comment spans  multiple lines%}

Odin

(According to Gemini AI):The Odin programming language supports two types of comment characters:Single-line comments: Begin with //.Code snippet// This is a single-line commentmy_variable: int // A comment for documentationMulti-line comments: Begin with /* and end with */. Multi-line comments can also be nested.Code snippet/*This is a multi-line comment./* NOTE: comments can be nested! */You can have any text or code here and have it be commented.*/

Oforth

Oforth has only single line comment (inside or outside definition)

// This is a comment...

ooRexx

Comments in ooRexx follow the same rules asREXX andNetRexx

/*  Multi-line comment block */-- this type of comment works in ooRexx, NetRexx and some of the more popular REXX implementations like Reginahour = 0  -- which is, like midnight, dude.hour = 12 /* time for lunch! works as well (and really everywhere) */

Openscad

The openscad geometry compiler supports C++ style comments:

// This is a single line comment/*  This comment spans  multiple lines*/

OPL

REM This is a comment.PAUSE 20 REM Can be placed behind statements, too.

OxygenBasic

'  Basic line comment;  Assembly code line comment// C line comment/* C block comment */

Oz

% one line comment%% often with double "%" because then the indentation is correct in Emacs/* multi line   comment*/

PARI/GP

Comments are similar to C. The block comment is identical:/* comment */. The line comment uses backslashes instead of slashes:\\ comment.

Pascal

(* This is a comment.   It may extend across multiple lines. *){ Alternatively curly braces  can be used. }(* This is a valid comment in Standard Pascal,   but not valid in [[Turbo Pascal]]. }{ The same is true in this case *)

In Pascal, comments cannot be nested.


PascalABC.NET

(* This is a    multiline comment *){ This is also a    multiline comment }//  This is a single line comment

PASM

# This is a commentprint "Hello\n"    # This is also a commentend

Peloton

Peloton encloses all comments inside <@ OMT></@> (fixed length opcode) or <# OMIT></#> (variable length opcode) whether single- or multi- line.

<@ OMT>This is amultilinecomment</@>

OMT suppresses evaluation of everything contained. There are a variety of extra opcodes which can be used to control how OMT functions at run time.

Perl

Works with:Perl version 5.x

Single line comment

# this is commented

These may also be at the end of a line

my $var = 1; # this is the comment part

Multi-line comments for inline documentation (Plain Old Documentation, or POD in Perl parlance) follow the format:

=podHere are my commentsthis is multi-line=cut

Note that technically, both of the lines beginning with the equals sign must be surrounded on either side for compatibility with all "POD" parsers.

Note also that any string beginning with an equals sign, and that appears in the initial column of a line, begins a multi-line comment. It does not have to be a POD "command:" the following are all valid:

=head1=head4=over 4=Any Old String

Such blocks always end in =cut.

For more info, type at a command prompt (or into a search engine): "perldoc perlpod"

Phix

Library:Phix/basics

Single line comment:

-- this is a comment.// this is also a comment.

Nestable multiline comments:

/*This is a commentprocedure oldproc()   /*     This is also a comment   */   puts(1,"kill me now")end procedure*/puts(1,"this is not a comment")
Output:
this is not a comment

In fact there are now a total of six(!) different types of comment in Phix:

#! opening shebang#[ .. #] for multiline shebangs-- standard line comments// C-style line comments/* .. */ standard nestable multiline comments--/* .. --*/ Euphoria-compatibility-style nestable multiline comments/code

PHP

Single line comment:

# this is commented// this is commented

These may also be at the end of a line:

$var = 1; # this is the comment part$var = 1; // this is the comment part

Basic syntax for multi-line comments:

/*Here are my commentsthis is multi-line*/

Note that; it is more common to see phpDocumentor styled multi-lined comments:

/** * phpdoc Comments * @todo this is a todo stub */

Picat

Works with:Picat
/* * Multi-line comment */% Single-line Prolog-style comment

PicoLisp

# The rest of the line is ignored#{   This is a   multiline comment}#NILImmediately stop reading this file. Because all text in the input file followinga top-level 'NIL' is ignored.This is typically used conditionally, with a read-macro expression like`*Dbgso that this text is only read if in debugging mode.

Pike

// This is a comment./* This is a    multi   line   comment */int e = 3; // end-of-statement comment.

PL/I

/* This is a comment. */
/* This is a multiline comment. */

Note: In PL/I, comments cannot be nested.

PL/SQL

Single line comment:

--this is a single line comment

Multiline comment:

/*this is a multilinecomment*/

End of line comment:

v_var number; --this is an end of line comment

Plain English

\A comment like this lasts until the end of the linePut 1 plus [there are inline comments too] 1 into a number.

PlainTeX

The default raw/bareTeX assigns the category code 14 (comment character) to the character %, andplainTeX, as alsoLaTeX (see hereComments in LaTeX, does not changeit; so the % starts a to-end-of-line comment in many TeX macro packages.

% this is a commentThis is not.

The final newline character is eaten and since it normally behaves like a space, the comment canbe used to hide the newline:

\def\firstpart#1{under#1}\def\secondpart{able}\def\complete{\firstpart{stand}%\secondpart}\complete

Outputsunderstandable; without % it would outputunderstand able.

Pluto

-- Single line comment--[[ Multi-line  comment ]]--[===[  Another syntax  [[ which may contain square brackets ]]]===]

Pop11

Pop11 has two kinds of comments: endline and C-like. Endline commentbegins with tree consecutive semicolons and ends at the end of line:

;;; This is a comment

C-like comments may be multiline:

/* First line   Second line */

C-like comments (unlike C) may be nested:

/* This is a comment /* containing nested comment */ */

One can also use conditional compilation to comment out sections of code

#_IF falsesome code #_ENDIF

however, commented out part must consist of valid Pop11 tokens. In particular, C-like comments must balance and strings must be terminated.The following is an error:

#_IF falseThis w'ont work#_ENDIF

because apostrophe starts an unterminated string.

PostScript

%This is a legal comment in PostScript

PowerShell

# single-line comment
Works with:PowerShell version 2
<# multi-line   comment #>

Processing

// a single-line comment/* a multi-line   comment*//* * a multi-line comment * with some decorative stars */// comment out a code line// println("foo"); // comment at the end of a lineprintln("foo bar"); // "baz"

Processing Python mode

# a single-line comment """Not strictly a comment, bare multi-line strings are usedin Python as multi-line comments. They are also used asdocumentation strings or 'docstrings' when placed as thefirst element inside function or class definitions.""" # comment out a code line# println("foo")# comment at the end of a lineprintln("foo bar") # "baz"# there is no way to make an inline comment

ProDOS

I don't know why this is even a task because it should be included in any decent programming language.

IGNORELINE your text here

ProgressBASIC

10 REM I AM A COMMENT

Prolog

% this is a single-line comment that extends to the end of the line
/* This is amulti-line comment */

PureBasic

PureBasic uses the ";" symbol to mark its comments. All text entered after ";" on a line is ignored by the compiler.

;comments come after an unquoted semicolon and last until the end of the linefoo = 5 ;This is a commentc$ = ";This is not a comment"  ;This is also a comment

Python

Python uses the "#" symbol to mark it's comments. After placing a "#", everything to the right of it in that line will be ignored.

# This is a commentfoo = 5 # You can also append comments to statements

Certain 'do nothing' expressions resemble comments

"""Un-assigned strings in triple-quotes might be used    as multi-line comments"""'''   "triple quoted strings" can be delimited by either 'single' or "double" quote marks; and they can contain mixtures   of other quote marks without any need to \escape\ them using any special characters.  They also may span multiple   lines without special escape characters.'''

Note that strings inserted among program statements in Python are treated as expressions (which, in void context, do nothing). Thus it's possible to "comment out" a section of code by simply wrapping the lines in "triple quotes" (three consecutive instances of quotation marks, or of apostrophes, and terminated with a matching set of the same). Using unassigned strings as comments is frowned on and may also trigger certain linters.

Documentation Strings

Python makes pervasive use of strings which immediately follow class and function definition statements, and those which appear as the first non-blank, non-comment line in any module or program file. These are called "documentation" strings or "docstrings" for short; and they are automatically associated with the__doc__ attribute of the class, function, or module objects in which they are defined. Thus a fragment of code such as:

#!/usr/bin/env python# Example of using doc strings"""My Doc-string example""" class Foo:     '''Some documentation for the Foo class'''     def __init__(self):        "Foo's initialization method's documentation" def bar():    """documentation for the bar function""" if __name__ == "__main__":    print (__doc__)    print (Foo.__doc__)    print (Foo.__init__.__doc__)    print (bar.__doc__)


... would print each of the various documentation strings in this example. (In this particular example it would print two copies of the first doc string which because __doc__ in the "current" name space is the same as __main__.__doc__ when our program is running as a script). If some other script were toimport this file (under the name "example" perhaps) then "My Doc-string example" would be the value ofexample.__doc__

Python "docstrings" are used by a number of tools to automatically generate documentation (for most of the Python standard libraries, classes, functions, etc, as well as for user programs which define docstrings). They are also used by tools such asdoctest to automatically derive test suites from properly formatted examples of class instantiations, function invocations and other usage samples. The standardpydoc utility can search through Python source trees generating documentation and can function as a local web server allowing a programmer to browse "live" hyperlinked documentation of their project.

(As noted above extraneous strings interspersed throughout a Python source file can be used as comments, though this is rarely done in practice; only those strings which lexically follow the definition of a class, function, module or package are assigned to __doc__ attributes in their respective name spaces).

Quackery

 ( The word "(" is a compiler directive (a builder,   in Quackery jargon) that causes the compiler to    disregard everything until it encounters a ")"   preceded by whitespace.     If you require more than that, it is trivial to   define new comment builders...                  )   [ behead carriage = until ] builds #   # Now the word "#" will cause the compiler to  # disregard everything from the "#" to the end of   # the line that it occurs on.   [ drop $ "" ] builds commentary   commentary     The word "commentary" will cause the compiler to  disregard everything that comes after it to the   end of the source string or file.


QB64

CBTJD: 2020/03/12

REM This is a remark...' This is also a remark...IF a = 0 THEN REM (REM follows syntax rules)IF a = 0 THEN '(apostrophe doesn't follow syntax rules, so use END IF after this)END IF'Metacommands such as $DYNAMIC and $INCLUDE use the REM (or apostrophe).REM $STATIC 'arrays cannot be resized once dimensioned.REM $DYNAMIC 'enables resizing of array dimensions with REDIM.REM $INCLUDE: 'loads a reference file or library.

R

# end of line comment

Racket

; this is a to-end-of-line coment#| balanced comment, #| can be nested |# |##;(this expression is ignored)#; ; the following expression is commented because of the #; in the beginning(ignored)

Raku

(formerly Perl 6)

Single-line comments

A single-line comment starts with # and extends to the end of the line.

# the answer to everythingmy $x = 42;

Multi-line comments

A multi-line comment starts with #` and followed by the commented text enclosed by bracketing characters (e.g., (), [], {}, 「」, etc.).

#`(     Comments beginning with a backtick and one or more opening bracketing characters are embedded comments.    They can span more than one line…)my $y = #`{ …or only part of a line. } 3;

Multi-line comments can also be embedded into code.

for #`(each element in) my @array {    say #`(or print element) $_ #`(with a newline);}

Using more than one bracketing character lets you include an unmatched close bracket, as shown below.

#`{{  This close curly brace } won't terminate the comment early.}}

Pod comments

=begin commentPod is the successor to Perl 5's POD. This is the simplest way to use it for multi-line comments.For more about Pod, see Pod: https://docs.perl6.org/language/pod=end comment

Pod also provides declarator blocks which are special comments that attach to some source code and can be extracted as documentation. They are either #| or #= and must be immediately followed by either a space or an opening curly brace. In short, blocks starting with #| are attached to the code after them, and blocks starting with #= are attached to the code before them.

#| Compute the distance between two points in the plane.sub distance(    Rat \x1, #= First point's abscissa,    Rat \y1, #= First point's ordinate,     Rat \x2, #= Second point's abscissa,     Rat \y2, #= Second point's ordinate, ){    return sqrt((x2 - x1)**2 + (y2 - y1)**2)}

Rapira

Comments in Rapira are preceded by a backslash (\).

\ This is a Rapira comment.

Raven

 # this is a comment

Rebol

; This is a line comment.{ Multi-line strings can  be used as comments   if you like }

Functions have special commenting options which make them self documenting:

plus2: func [    "Adds two to a number."    n [number!] "The number to increase."][    n + 2]

If you say "help plus2" at REBOL's REPL, you'll get this help information:

   USAGE:       PLUS2 n      DESCRIPTION:        Adds two to a number.        PLUS2 is a function value.      ARGUMENTS:        n -- The number to increase. (Type: number)

Relation

// This is a valid comment // A space is needed after the double slash

Retro

( comments are placed between parentheses. A space must follow the opening parenthesis. )

REXX

It should be noted that comments in the REXX language supportnested comments, so comments aren't totally ignored by the REXX interpreter (and compiler).

REXX comments are scanned and preserved for use by the  sourceline   BIF.   [The  sourceline   BIF allows the retrieval of any or all lines of source (of the REXX program).]

Also, redundant blanks are removed and processed/shown for various  trace   options   (trace   is a REXX statement that may show various interpretation/execution stages of REXX statements (clauses, values, etc.),   including comments and also blank lines).   The  trace   statement is also used for interactive debugging.

Nested comments must have matching delimiters, so the contents of the comments can't just be willy-nilly characters.


Also, some REXX interpreters show the comment (if part of a REXX statement) as part of the information displayed when (if) a  syntax   error occurs and an informative error message is generated.   For instance, in the program   (named c:\COMMENTD.REX):

/*REXX program that demonstrates what happens when dividing by zero.  */y=7say 44 / (7-y)      /* divide by some strange thingy.*/

output   when using the Regina REXX interpreter:'

     3 +++ say 44 / (7-y)      /* divide by some strange thingy.*/Error 42 running "c:\COMMENTD.REX", line 3: Arithmetic overflow/underflowError 42.3: Arithmetic overflow; divisor must not be zero

output   when using the R4 REXX interpreter:'

Error 42 : Arithmetic overflow/underflow (SYNTAX)Information: Divide by zeroError occurred in statement# 3Statement source: say 44/(7-y)Statement context: c:\commentdv.rex, procedure: commentdv

output   when using the Personal REXX interpreter:'

     3 +++ say 44 / (7-y)      /* divide by some strange thingy.*/Error 42 on line 3 of C:\COMMENTD.REX: Arithmetic overflow/underflow


TheREXX language was heavily modeled afterPL/I, both languages have the same comment construct, butPL/I doesn't support nested comments.


Nested comments allow an easy way to comment large chunks of code where the commented-out code has its own comments.

/*REXX program to demonstrate various uses and types of comments. *//* everything between a "climbstar" and a "starclimb" (exclusive of literals) is   a comment.                          climbstar =  /*   [slash-asterisk]                               starclimb =  */   [asterisk-slash]            /* this is a nested comment, by gum! */            /*so is this*/Also, REXX comments can span multiple records.There can be no intervening character between the slash and asterisk  (orthe asterisk and slash).  These two joined characters cannot be separatedvia a continued line, as in the manner of:       say 'If I were two─faced,' ,           'would I be wearing this one?' ,           '      --- Abraham Lincoln' Here comes the thingy that ends this REXX comment. ───┐                                                       │                                                       │                                                       ↓                                                       */    hour = 12       /*high noon                   */midnight = 00       /*first hour of the day       */   suits = 1234     /*card suits:   ♥  ♦  ♣  ♠    */ hutchHdr = '/*'  hutchEnd = "*/"    /* the previous two "hutch" assignments aren't        the start  nor  the end of a REXX comment. */  x=1000000 **   /*¡big power!*/   1000/*not a real good place for a comment (above),   but essentially, a REXX comment can be   anywhere whitespace is allowed.            */

A Classic REXX implementation (e.g. Regina) also allow line comments which start with a  --   sequence and extend to the end of the line:

[Note:   Regina REXX releases since 3.4 allow this type of single-line commentonly if the optionSingle_Line_comments isn't present in theREGINA_OPTIONS environmental variable.   So, Reginamay allow the use of single-line comments,   depending upon which release is being used.   That is to say, one can't depend (or assume) that the Regina extension (of single-line comments) for the aforementioned option will be or not be present (supported and/or allowed) in the environment being used].   Which means one could set this option to their preference if using Regina REXX later than version 3.3.

Since Single-Line comments aren't part of the ANSI standard nor a part of the Classic REXX language, the use of which would make the REXX codenon-portable.]


-- A REXX line comment (maybe)say "something" -- another line comment (maybe)

It should be noted that the above type of comments are not part of Classic REXX, nor are they described nor sanctioned in the REXX ANSI standard.

Ring

in Ring language we can use // or # for one line comments:

//this is a single line comment#this also a single line comment!

and for multi-line comments we use /* */:

/*This is a multi-linecomment that will be completelyignored by the compiler/interpreter*/

RLaB

RLaB only has single line comment indicator, as in following examples

x = "code" # I am a commentx = "code" // Here I comment thee#  matlab-like document line// C++ like document line

Robotic

Comments can only be created in one way:

. "This is a comment line". "Print Hello world"* "Hello world.". "This is the only way to comment a line in Robotic"

Although these are comments, the interpreter doesn't completely ignore it. For one, the code speed can be affected if they are ever encountered. Also, if an @ character exists at the beginning of the comment line, then the rest of the string after it is now the Robot's new name (there is a 14 character limit).

Example of changing the robot's name:

. "@NewRobotName"

This would then change the robot's name from whatever it was before to "NewRobotName" instead.

Rockstar

Rockstar is cool.(Rockstars don't like comments, but if you really really want to, you write them in parentheses and they are believed to be multiline. In fact, parentheses are just the comment symbols, so you can't even use parentheses in math, so if you want the addition to happen before the multiplication, do the addition and assign it to a variable. And by the way, the Rockstar is cool line assigned the number 4 to the variable Rockstar, because cool is four letters and all that. And this comment has gone on way too long for a language with a developer community that hates comments.)Shout Rockstar.(Might as well put that number 4 on the screen.)

RPL

Although its code can sometimes be difficult to read due to stack operations, basic RPL does not provide any functionality to comment out. The only solution is then to insert strings and delete them immediately, such as:

≪    SWAP -"swap the first 2 levels and subtract" DROP

From 1993, comments can be added in a source code written with a text editor on a computer, starting with an @ and ending by either another @ or a newline character, before transfer to and compilation by the calculator. The compilation step removes all comments.

≪    SWAP -@ swap the first 2 levels and subtract

RTL/2

In RTL/2, there are two types of comments:

  • Inline comments are written between paired % characters, they can include any characters except % and newline, e.g.:
% THIS IS A COMMENT %
Inline comments can appear anywhere between tokens in the source, they can also appear in numeric inserts in string literals.
E.g.:
"HELLO, WORLD!# NL % INSERT A NEWLINE INTO THE STRING, ASSUMING LET NL = 10; HAS BEEN SPECIFIED % #"
  • TITLE comments can appear at the module level in a source file - i.e., not inside a procedure or DATA brick or string numeric insert.
TITLE comments begin with the reserved word TITLE and end with a semicolon. They can contain any characters except semicolon, so can be multi-line. A source file can contain more than one TITLE comment. E.g.:
TITLE SOME COMMENTARY TEXT,      POSSIBLY DESCRIBING THE APPLICATION;

Ruby

x = "code" # I am a comment=begin helloI a POD documentation comment like Perl=end puts "code"

Run BASIC

Comments have a ' (single quote) or REM for remarks

'This is a commentREM This is a comment print "Notice comment at  the end of the line."          'This is a commentprint "Also notice this comment at the end of the line." : REM This is a comment

Rust

// A single line comment/*    This is a multi-line (aka block) comment    /*        containing nested multi-line comment        (nesting supported since 0.9-pre https://github.com/mozilla/rust/issues/9468)    */*//// Outer single line Rustdoc comments apply to the next item./**    Outer multi-line Rustdoc comments. *  Leading asterisk (*) in multi-line Rustdoc comments *  is not considered to be part of the comment text, *  blanks and tabs preceding the initial asterisk (*) are also stripped.*/fn example() {    //! Inner single line Rustdoc comments apply to their enclosing item.    /*!        Inner multi-line Rustdoc comments.        See also https://github.com/mozilla/rust/wiki/Doc-using-rustdoc    */}#[doc = "Unsugared outer Rustdoc comments.        (outer attributes are not terminated by a semi-colon)"]fn example() {    #[doc = "Unsugared inner Rustdoc comments.            (inner attributes are terminated by a semi-colon)            See also https://github.com/mozilla/rust/blob/master/doc/rust.md#attributes"];}

SAS

/* comment */*another comment;* both  may  be  multiline;

Sather

-- a single line comment

S-BASIC

rem S-BASIC of course allows traditional BASIC-style commentscomment  In addition to the single-line REM statement, S-BASIC   also supports multiline comments using COMMENT...END.  Note that the terminating END must be the first token on  a line of its own.endcomment  When declaring a group of variables, S-BASIC allows  a semi-colon, instead of the normal comma, as a separator,  in which event an explanatory comment can follow the  semi-colon and is ignored by the compiler.endvar n   ; number of payments over life of loan    ppy ; payments per year    apr ; annual interest rate as a decimal    amt ; principal amount of loan    pmt ; amount of periodic payment        = realcomment   Finally, although statements in S-BASIC are normally terminated   by an end-of-line, any logical statement can be continued on to    the following physical line with a backslash, in which event   anything after the backslash is ignored and can be used for    a comment. end if amt = 0 then      \ user forgot to enter a value   print "Must specify a loan amount!"end

Scala

// A single line comment/* A multi-line    comment */

Scheme

; Basically the same as Common Lisp; While R5RS does not provide block comments, they are defined in SRFI-30, as in Common Lisp :#| comment... #| nested comment... |#|#; See http://srfi.schemers.org/srfi-30/srfi-30.html

Scilab

Specify a comment starting with // to the end of line

// this is a commenti=i+1 // this is a comment

sed

# a single line comment

Seed7

# A single line comment(* A multi-line     comment *)(* In Seed7, (* comments can be nested. *) *)

SenseTalk

#   Hashtag is a comment--  Dash dash is another comment//  Slash slash is yet another comment—   Alt/Option + Underscore creates an m-dash comment(*  Parentheses and star is used for commentingblocks of code (* and can be nested *) *)set foo to true // all comments can append to statements

Set lang

> Comments start where a > (greater than symbol) startsset a 0 > Comments may start after a Set command

SETL

print("This is not a comment"); -- This is a comment$ For nostalgic reasons, this is also a comment.

Sidef

Single line comment

# this is commented

These may also be at the end of a line

var i = 1; # this is the comment part

Embedded comments

var distance #`{in meters} = (30 #`{meters} * 100 #`{seconds});say distance; # prints: 3000

Multi-line comments

/*    This is a multi-line comment*/

Simula

The same as Algol 60:

COMMENT This is a comment for Simula 67;

And an new form:

!This is a comment for Simula 67;

Pitfall: it'snot easy tocomment-out parts of code:

!OutText("Dying."); !Outimage; !terminate_program;

Slate

"basically the same as smalltalk"

Smalltalk

"Comments traditionally are in double quotes.""Multiline comments are also supported. Comments are saved as metadata along with the source to a method. A comment just after a method signature is often given to explain the usage of the method. The class browser may display such comments specially."

smart BASIC

'Single line comments are preceded by a single quote or the command REMPRINT "Hello" 'Single line comments may follow codePRINT "Hello" REM You can also use the command REM following code/*Multi-line commentsare surrounded bymirrored slashand asterisk *//*Multi-line comments do not have to actually have multiple lines*//* Spaces before or after comment bounds are optional.*//* A comment can also follow another comment */  'Like thisSome programmers like to do this to allow for /* Procedural comments */ followed by 'Programmer's notes.

SNOBOL4

* An asterisk in column 1 is the standard Snobol comment* mechanism, marking the entire line as a comment. There* are no block or multiline comments.*               Comments may begin at*               any position on the line.- A hyphen in column 1 begins a control statement. - Unrecognized control statements are ignored and- may also mark comment lines. Not recommended.                   ;* The semicolon statement separator    output = 'FOO' ;* begins a new statement. This idiom    output = 'BAR' ;* simulates an asterisk in the first                   ;* column, allowing end of line comments.ENDAny text after the required END label is ignored.

SNUSP

As withBrainf*** andBefunge, any character that is not part of the language is ignored and can be used as commentary, and you can add comments anywhere the instruction pointer is not expected to traverse. Reserved characters are:

  • Core: + - > < , . ? ! / \ $ #
  • Modular: @ #
  • Bloated: : ; & %

As a matter of convention, the characters '=' and '|' are used for spacing to indicate horizontal and vertical flow of control, respectively.

SPL

'This is single-line comment''This ismultiline comment''

SQL

The double hyphen ( -- ) is used to include a comment on an SQL statement.

The comment appears on the same line as the statement:

SELECT * FROM mytable -- Selects all columns and rows

or before:

-- Selects all columns and rowsSELECT * FROM mytable

or after:

SELECT * FROM mytable -- Selects all columns and rows

SQL PL

Works with:Db2 LUW

Single line comment:

--This is a single line comment.

Multiline comment:

/* This isa multilinecomment */

Another way to do multiline comments

(= This isa multilinecomment =)

End of line comment:

declare myvar number; --This is an end of line comment.

Comments work the same as inSQL.

Squirrel

//this is a single line comment#this is also a single line comment/*    this is a multi-line comment*/

SSEM

The SSEM can only be programmed in pure binary, by setting front panel switches: the concepts of "text" and "source file" (both mentioned in the specification) are therefore not directly applicable to it. If binary numbers have any mnemonic or explanatory value for you, however, there is a way of including information in your program that the computer will ignore. This is a direct result of the machine's rather poor code density. Each 32-bit instruction word consists of (a) a five-bit address field giving the operand, (b) eight unused bits, (c) a three-bit instruction field giving the operation to be performed, and (d) sixteen more unused bits. If the instruction field is set to011 Test or111 Stop, even the address field is unused. In the case of aSub. instruction, finally, the leftmost bit of the instruction field is disregarded:001 and101 both mean "subtract". We therefore have at least 24 and sometimes 25 or 29 bits in each instruction that we can, if we like, use for comments. The word

00101010010001000100100100001100

will be understood by the machine asAdd 20 to CI, a normal instruction. But it also fits four comment characters into the unused bits, employing a simple five-bit encoding whereA=0 andZ=25. The instruction breaks down as follows:

00101 --address field = 20

01001 --"comment" field = 18

000 --three unused bits

100 --instruction field =Add to CI

01001 --"comment" field = 18

00100 --"comment" field = 4

01100 --"comment" field = 12

0 --unused bit

Applying our simple alphabetic encoding, we see that the "spare" bits spell out 18, 18, 4, 12 = S, S, E, M.

More realistically, you can include comments when you are drafting your program using mnemonic notation and then simply leave the comments out when it comes time to toggle the program in.

Standard ML

(* This a comment   (* containing nested comment *) *)

Stata

* Line comment: must be used at the beginning of a line (does not work in Mata)// Line comment until the end of the line/* Multiline comment*/

Stax

Line comments begin with a tab.

	This is a comment

SuperTalk

-- This is a comment

Swift

// this is a single line comment/* This a block comment   /* containing nested comment */ *////This is a documentation comment/**  This is a documentation block comment*/

Symsyn

| This is a comment

Tcl

Tcl follows the usual scripting language rules: a comment starts at a "#" symbol, which can be placed after a command if that is terminated by a semicolon:

# comment on a line by itself. The next is a command by itself:set var1 $value1set var2 $value2 ; # comment that follows a line of code

The reason for the need for a semi-colon on a trailing comment is this:

"If a hash character (“#”) appears at a point where Tcl is expectingthe first character of the first word of a command, then the hash character and the characters that follow it, up through the next newline, are treated as a comment and ignored.The comment character only has significance when it appears at the beginning of a command." (from theTcl man page -- emphasismine)

The "#" symbol has no special meaning if it is not where a command would appear -- it's just data. (Syntax highlighters often get this wrong.)

set aList {foo}lappend aList # barputs $aList           ;# ==> prints "foo # bar"puts [llength $aList] ;# ==> 3

TCL has no native multi-line comment format. However, in most circumstances, a multi-line comment can be faked by wrapping it within a block that will never be executed:

if 0 {   Comments...}

Tern

SeeJava

TI-83 BASIC

There is no 'proper' way of adding comments in TI-BASIC, however there are ways to add text to a program that will be ignored by the calculator.

One common approach is to put the comment in a string which is not stored anywhere:

:"THIS IS A COMMENT

However this will change the Ans variable.

This approach, while messier, does not affect the Ans variable:

:If 0:THIS IS A COMMENT

TI-89 BASIC

© This is a comment. Everything from © to the end of the line is ignored.

Tiny BASIC

10 REM this is a comment2040 REM from above you can see that line numbers with no statement50 REM and blank lines also are ignored

Toka

There are two ways to add comments in Toka. For full lines, or at the end ofa line, the shebang is normally used:

#! Everything on this line (after the shebang to the left) will be ignored.

The shebang comments can not be used inside of functions.

In addition, Toka also accepts parenthetical comments. These are enclosed in parenthesis, and are often used for stack comments or comments inside functions.

[ ( a b -- c )   ... ] is myword

In addition, parenthetical comments can span multiple lines.

( This is a  simple, multi-line  comment )

Since comments are provided by actual functions, the comment function must be whitespace delimited, just as with all other functions in Toka.

A final way to include text in a file is to mark a false ending withend.

... code ....end.Nothing following the end. will be evaluated by Toka.

TorqueScript

//This is a one line comment. There are no other commenting options in TorqueScript.

TPP

--## comments are prefixed with a long handed double paintbrush


Transd

// This is a line comment./* This is a single line block comment.*//* This is   a multi-line   block comment.*/

TUSCRIPT

$$ MODE TUSCRIPT- This is a comment

TXR

@# old-style comment to end of line@; new-style comment to end of line@(bind a ; comment within expression       "foo")

Uiua

# This is a comment

UNIX Shell

Works with:Bourne Shell
Works with:Korn Shell
#!/bin/sh# A leading hash symbol begins a comment.echo "Hello"      # Comments can appear after a statement.# The hash symbol must be at the beginning of a word.echo This_Is#Not_A_Comment#Comment

C Shell

#!/bin/csh -f# C Shell has a similar comment syntax, but only allows comments in a# script file, not in terminal input.echo Hello#With C Shell, the hash can also be in the middle of a word.

es

# Comments in es (extensible shell) look like those of other shells.echo Hello#With es, the hash can also be in the middle of a word.

Unlambda

Unlambda comments start with# and extend to the end of the line:

# this is a comment.

Note that comments don't need to start at the beginning of a line, e.g.

`  # apply.a # output "a"i  # identity

is equivalent to

`.ai

Ursa

Comments in Ursa must be on a single line, and are denoted by a #

# this is a comment# this is another comment

Ursala

There are lots of ways to have comments in Ursala.Here are the conventional ones.

# this is single line a comment# this is a\continued comment(# this is amulti-line comment #)(# comments in (# this form #) can (# be (# arbitrarily #) #) nested #)---- this is also a comment\and can be continued###The whole rest of the file after three hashesis a comment.

Commenting out code

There are also ways to comment out sections of code during testing.An individual item of a syntactically correct list or aggregate is commentedout like this.

x = <1,## 2,3>

The 2 is ignored but 1 and 3 aren't. This also works withnested aggregates and multiple lines.

a =<   'to',   ## <      'be',      'or'>,   'not',   'to',   ## 'be'>

A syntactically correct declaration can be commented out like this.

foo = 1##bar = 2baz = 3

As far as the compiler is concerned, bar is not defined, but foo and baz are.It wouldn't matter if bar took multiple lines.

Comments in compiled files

The compiler can be directedto embed comments in executable files and libraries it generates withoutaffecting their semantics.

#comment -[I document the source text but will also be embedded inthe output library or executable file.]-#comment gpl'3'

The latter comment puts the standard GPL license notification in the output file.

Comments as diagnostics

A function f annotated with a crash dump wrapper expressed like thisduring debugging

my_input_type%C f

is equivalent to just f when changed to this in the production code.

my_input_type%Ck f

Comments as hooks

Compiling with the --depend command line option makes the compiler only scan for the #depend'edexpressions and send them to standard output.

#depend <this,expression> is (parsed)* but {   otherwise,   ignored}

This way, scripts and source management tools can have information passed to them fromthe programmer by running the compiler instead of re-implementing their own parsers.

Uxntal

Comments are delimited by parenthesis surrounded by white space.

  • Valid:
( comment )
  • Invalid:
(comment )
(comment)
( comment)

By convention comments are used to indicate:

  • Stack effects, ie
    ( a b -- a+b )
  • Routines that flow through to the next one without returning:
    ( >> )
  • Vectors:
    ( -> )

Example:

(    Print a hex byte to decimal.)( macros )%\n { 0a }%newline { [ LIT2 \n -Console/write ] DEO }( devices )|10 @Console/vector $2 &read $1 ( &pad is unused ) &pad $5 &write $1 &error $1( main program )|100 @on-reset ( -> )#42 print/dec newlineBRK( library )@print/dec ( dec -- )DUP #64 DIV /dec/tryDUP #0a DIV /dec/try( >> )&dec/num ( num -- )#0a DIVk MUL SUB [ LIT "0 ] ADD .Console/write DEOJMP2r&dec/try ( num -- )DUP ?/dec/numPOP JMP2r
Output:
66

VBA

A comment starts with a quote (') and it ends at end of line

' This is a VBA comment

VBScript

A comment starts with a quote (') and it ends at end of line

' This is a VBScript comment

Verbexx

////////////////////////////////////////////////////////////////////////////////////////////////// Line Comments: // =============//@VAR v1 = 10; // Line comments start from the "//" and continue to end of the line. //               (normal code can appear on the same line, before the //)////   Line comments can span a complete line, or start in the middle of a line./////// Additional // chars and /* /*  /[  ]/ and  /] are ignored//// Line comments can be appear to be nested, since any additional // is ignored./////   Note: // can appear in strings without triggering a line comment//         // cannot appear inside an operator (or verbname), since a line comment//            would start////////////////////////////////////////////////////////////////////////////////////////////////******************************************************************************************** * *  Block Comments: *  ============== * ********************************************************************************************///* //*  These start with /* and end with the next */ .  They cannot be nested, since the first */  //*  will end the block comment.  For example, the comment, /* /* */ */ would end after the     //*  first */. Note that /* is ignored inside a block comment, as are   //   /[   /] and  /].//* //*  Also note that something like the following will cause trouble in a block comment://* //*    /* comments                          ////*     * more comments                     //   */  (the // does not prevent the */ from ending    //*     * (no longer part of the comment)   //        block comment)//*     *///* //*    Note: /* can appear in strings without triggering the start of a block comment//*          /* cannot appear inside an operator (or verbname), since a line comment will//*             start, although */ is allowed inside an operator (verbname).  Commenting//*             out such a verbname may cause problems.//* //*    Note: Since string literals are not recognized in block comments, */ appearing//*          in a string literal inside a block comment (perhaps commented-out code)//*          will cause the block comment to end.  //* //*    Note: It is an error to start a block comment and not end it, so that it is still//*          in progresss when the end-of-file is reached.//* //*    Block comments can appear inside lines of code:  //* /*1*/@VAR/*2*/v2/*3*/=/*4*/20/*5*/;/*6*/  // a line comment can follow block comments on the                                            // same line/[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] /[]                                                                                          [] /[]     Nestable Block Comments:                                                             [] []     ========================                                                             []/ []                                                                                          []/ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]/ //[] //[]  These start with /[ and end with the next matching ]/ .  Additional occurrences//[]  of /[ ... ]/ can appear inside a nestable block comment.  The nestable block comment    //[]  will end only when the nest level reaches 0.  Note that /* is ignored inside a nestable     //[]  block comment, as are  */   //  and  /].//[]//[]  Nestable block comments can be used to comment out blocks of code containing line //[]  comments or regular comments, and even balanced and well-formed nestable block comments.//[] //[]    Note: /[ can appear in strings without triggering the start of a block comment.  //[]          However, strings literals are not recognized inside a nestable block comment, so//[]          any appearances of /[ and /] inside a string literal in a nestable block commment //[]          will affect the nest level, and may cause problems.//[] //[]    Note: It is an error to start a nestable block comment and not end it, so that it is//[]          still in progresss when the end of file is reached.//[] //[]    Nestable block comments can appear inside lines of code:  //[] /[1]/@VAR/[2]/v3/[3]/=/[4]/30/[5]/;/[6]/  // a line comment can follow nestable block comments                                           // on the same line@SAY v1 v2 v3;                            // should see:   10 20 30/]/=================================================================================================\|                                                                                                 ||   /] starts a block comment that lasts until the end of the current file.  Everything after     ||   the /] is ignored.                                                                            ||                                                                                                 |\=================================================================================================/

Verilog

// Single line commment. /*    Multiple   line   comment.*/

VHDL

-- Single line commment in VHDL

Vim Script

All lines starting with " are comments and will be ignored.

In most cases, " will also work after a command (i.e. the rest of the line will be ignored). But some commands likeecho treat the whole line as their argument and thus will raise an error (Missing quote).

let a = 4 " A valid commentecho "foo" " Not a comment but an argument that misses the closing quote

Visual Basic

In addition to the methods mentioned inBASIC above, it is also somewhat common to effectively comment out code by including the unwanted code inside an#If 0 ... #End If block. (This works because 0 evaluates to False in VB.) Note, however, that the IDE will complain about actual comments inside an#If 0 block unless it's also commented normally (i.e., usingRem or').

'commentRem comment#If 0  Technically not a comment; the compiler may or may not ignore this, but the  IDE won't. Note the somewhat odd formatting seen here; the IDE will likely  just mark the entire line(s) as errors.#End If

Visual Basic .NET

Visual Basic .NET uses the "'" symbol or "REM" to mark it's comments. After placing a "'", or "REM", everything in that line will be ignored.

' This is a commentREM This is also a commentDim comment as string ' You can also append comments to statementsDim comment2 as string REM You can append comments to statements

Visual Objects

// This is a comment/* This is a comment */* This is a comment&& This is a commentNOTE This is a commen

V (Vlang)

// This is a single line comment./*This is a multiline comment.   /* It can be nested. */*/

Vorpal

# single line comment

Wart

# single-line comment

Wren

// This is a line comment./* This is a single line block comment.*//* This is   a multi-line   block comment.*//* This is/* a nested */block comment.*/

X10

All text included within the ASCII characters “/*” and “*/” is considered a comment and ignored; nested comments are not allowed.

All text from the ASCII characters “//” to the end of line is considered a comment and is ignored.

// This is a single line comment/*   This comment spans  multiple lines*/

XLISP

; this is a comment

Xojo

// Comments are denoted by a preceding double slash or or single quote' and continue to the end of the line. There are no multi-line comment blocksDim foo As Integer // Comments can also occupy the ends of code lines

XPL0

Comments are enclosed in backslash characters, but the end of a linealways terminates a comment. Consequently there is no multi-linecomment. For example:

Text(0, \comment\ "Hello \not a comment\ World!"); \comment

Since backslashes toggle comments on and off, it could be inconvenient tocomment out a line of code that contains a comment. For example, twoadditional backslashes could be used to comment out this line, as shown here:

 Text(0, "Hello World");  \comment\Text(0, "Hello World"); \\comment

However, two backslashes together comment out everything to the end ofthe line regardless of any backslashes the line might contain. So thefirst example could be commented out like this:

\\Text(0, \comment\ "Hello \not a comment\ World"); \comment

Conditional compilation can be used to effectively comment out multiplelines of code. For example:

cond false;Text(0, "Hello World"); \commentCrLf(0);cond true;

XQuery

(: This is a XQuery comment :)

XSLT

<!-- Comment syntax is borrowed from XML and HTML. -->

XUL

<!-- Comment syntax is borrowed from XML and HTML. -->

Yacas

Yacas supports C++ style comments:

// This is a single line comment/*   This comment spans  multiple lines*/

Z80 Assembly

Note: syntax depends on the assembler software but use of a semicolon is fairly standard. VASM and WinAPE use the semicolon.

 ld hl,&8000  ;This is a comment

Zig

// This is a normal comment in Zig/// This is a documentation comment in Zig (for the following line)

zkl

x=1; // comment ala C++x=2; # ala scripts/* ala C, these comments are parsed (also ala C) *//* can /* be */ nested */#if 0  also ala C (and parsed)#endif#<<<#  "here" comment, unparsed#<<<#

Zoea

program comments        # this program does nothing# zoea supports single line comments starting with a '#' char/*  zoea also supports   multi line  comments*/

Zoea Visual

Comments

zonnon

(* this is a comment *)(*    and this is a   multiline comment   (* with a nested comment *)*)

Retrieved from "https://rosettacode.org/wiki/Comments?oldid=396252"
Categories:
Hidden category:
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

[8]ページ先頭

©2009-2026 Movatter.jp