Comments: Difference between revisions

21,567 bytes added ,  17 days ago
m
Remove FutureBasic apostrophe single line comment as it's deprecated
m (Remove FutureBasic apostrophe single line comment as it's deprecated)
 
(47 intermediate revisions by 26 users not shown)
Line 18:
 
=={{header|11l}}==
<lang 11lpre>// Single line comment
\\ Also single line comment (continuation of the comment in previous line)
 
Line 32:
 
\‘ And
this ’</langpre>
 
=={{header|360 Assembly}}==
<syntaxhighlight lang="360 assembly">
<lang 360 Assembly>
* An asterisk in column one denotes a comment line
* Comments may also follow any syntactically complete instruction:
Line 42:
* Comments after instructions with omitted operands require a comma ","
END , Comment (without comma, "Comment" assumed an operand of "END")
</syntaxhighlight>
</lang>
 
=={{header|4D}}==
<langsyntaxhighlight lang="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 //</langsyntaxhighlight>
 
=={{header|6502 Assembly}}==
Note: syntax depends on the assembler software but use of a semicolon is fairly standard
<langsyntaxhighlight lang="6502 Assemblyassembly"> nop ; comments begin with a semicolon</langsyntaxhighlight>
 
=={{header|68000 Assembly}}==
Line 56:
 
EASy68k uses * as the comment character. VASM uses a semicolon ;
<langsyntaxhighlight lang="68000devpac"> MOVEM.L D0-D7/A0-A6,-(SP) ;push all registers onto the stack</langsyntaxhighlight>
 
=={{header|8086 Assembly}}==
Note: syntax depends on the assembler software but use of a semicolon is fairly standard
<langsyntaxhighlight lang="asm"> MOV AX, 4C00h ; go back to DOS
INT 21h ; BIOS interrupt 21 base 16</langsyntaxhighlight>
 
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
<syntaxhighlight lang="aarch64 assembly">
<lang AArch64 Assembly>
/* ARM assembly AARCH64 Raspberry PI 3B */
/* comments multi lines
Line 73:
 
// comment end of ligne
</syntaxhighlight>
</lang>
=={{header|ACL2}}==
Just like Common Lisp:
<langsyntaxhighlight Lisplang="lisp">; Single line comment
#| Multi-line
comment |#</langsyntaxhighlight>
 
=={{header|Action!}}==
Action! supports only single line comments which begin with semicolon.
<langsyntaxhighlight Actionlang="action!">;This is a comment
 
PROC Main() ;This is a comment as well
RETURN</langsyntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Comments.png Screenshot from Atari 8-bit computer]
Line 93:
 
=={{header|Ada}}==
<langsyntaxhighlight lang="ada">-- All Ada comments begin with "--" and extend to the end of the line</langsyntaxhighlight>
 
=={{header|Agena}}==
Agena has single line comments and two styles of multi-line comments.
<langsyntaxhighlight lang="agena"># single line comment
 
#/ multi-line comment
Line 105:
/* multi-line comment - C-style
- ends with the "* followed by /" terminator on the next line
*/</langsyntaxhighlight>
 
=={{header|ALGOL 60}}==
A comment in ALGOL 60 takes the place of a single instruction.
<langsyntaxhighlight lang="algol_60">
'COMMENT' this is a first comment;
'COMMENT'
****** this is a second comment ******
;
</syntaxhighlight>
</lang>
 
=={{header|ALGOL 68}}==
Line 152:
===With Extensions===
&pound; This is a hash/pound comment for a UK keyboard &pound;
 
=={{header|ALGOL-M}}==
<syntaxhighlight lang="ALGOL">
begin
 
comment - 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
</syntaxhighlight>
 
 
=={{header|ALGOL W}}==
Line 158 ⟶ 174:
A single word in the form of an identifier following the reserved word 'end' is also a comment.
 
<langsyntaxhighlight lang="algolw">begin
comment a comment;
% another comment
Line 165 ⟶ 181:
another
%
end this_word_is_also_a_comment.</langsyntaxhighlight>
 
=={{header|AmigaE}}==
<langsyntaxhighlight lang="amigae">/* multiline comment
are like C ... */
-> this is a end of line comment</langsyntaxhighlight>
 
=={{header|AngelScript}}==
<syntaxhighlight lang="angelscript">// This is a comment</syntaxhighlight>
 
=={{header|AntLang}}==
<langsyntaxhighlight AntLanglang="antlang">2 + 2 /This is a comment</langsyntaxhighlight>
 
=={{header|Apex}}==
<langsyntaxhighlight lang="apex">
System.debug ('I will execute'); // This comment is ignored.
/*
I am a large comment, completely ignored as well.
*/
</syntaxhighlight>
</lang>
 
=={{header|APL}}==
<syntaxhighlight lang ="apl">⍝ This is a comment</langsyntaxhighlight>
 
=={{header|AppleScript}}==
<syntaxhighlight lang="applescript">
<lang AppleScript>
--This is a single line comment
 
Line 200 ⟶ 219:
(* Nested block comment *)
*)
</syntaxhighlight>
</lang>
 
{{works with|AppleScript|2.0}}
<langsyntaxhighlight AppleScriptlang="applescript">display dialog "ok" #Starting in version 2.0, end-line comments can begin with a hash</langsyntaxhighlight>
 
=={{header|Arendelle}}==
Line 212 ⟶ 231:
{{works with|as|Raspberry Pi}}
 
<syntaxhighlight lang="arm assembly">
<lang ARM Assembly>
/* ARM assembly Raspberry PI comment one line */
/* comment line 1
Line 221 ⟶ 240:
mov r1,#0 // authorized comment
 
</syntaxhighlight>
</lang>
 
=={{header|Arturo}}==
<langsyntaxhighlight lang="rebol">; This is a simple single-line comment
 
a: 10 ; another single-line comment
 
; Now, this is a
; multi-line comment</langsyntaxhighlight>
 
=={{header|Asymptote}}==
<syntaxhighlight lang Asymptote="asymptote">// double slash to newline</langsyntaxhighlight>
 
See [http://asymptote.sourceforge.net/doc/Programming.html programming introduction in the Asymptote manual].
Line 239 ⟶ 258:
 
=={{header|AutoHotkey}}==
<langsyntaxhighlight AutoHotkeylang="autohotkey">Msgbox, comments demo ; end of line comment
/*
multiline comment1
multiline comment2
*/</langsyntaxhighlight>
 
For multi-line comments, the '''/*''' and '''*/''' '''must''' be on their own separate lines. Nothing else can be on the same line.
Line 249 ⟶ 268:
=={{header|AutoIt}}==
 
<syntaxhighlight lang="autoit">
<lang AutoIt>
#cs
Everything between the cs and and the ce is commented.
Line 255 ⟶ 274:
#ce
;individual lines after a semicolon are commented.
</syntaxhighlight>
</lang>
 
=={{header|AWK}}==
Line 261 ⟶ 280:
The ''hash'' symbol # start a comment; it ends at the end of line.
 
<langsyntaxhighlight lang="awk">BEGIN { # this code does something
# do something
}</langsyntaxhighlight>
 
=={{header|Axe}}==
 
<langsyntaxhighlight lang="axe">.This is a single-line comment</langsyntaxhighlight>
 
<langsyntaxhighlight lang="axe">...
This is a multi-line comment
...</langsyntaxhighlight>
 
<langsyntaxhighlight lang="axe">...If 0
This is a comment only if the condition evaluates to zero
...</langsyntaxhighlight>
 
<langsyntaxhighlight lang="axe">...!If 1
This is a comment only if the condition evaluates to nonzero
...</langsyntaxhighlight>
 
<langsyntaxhighlight lang="axe">...Else
This is a comment only if the previous conditional comment was executed (and vice versa)
...</langsyntaxhighlight>
 
=={{header|Babel}}==
<langsyntaxhighlight lang="babel">
-- This is a line-comment
 
Line 294 ⟶ 313:
 
dedent: 0x42 -- The comment block above is now closed
</syntaxhighlight>
</lang>
 
=={{header|BASIC}}==
Line 306 ⟶ 325:
{{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 the <code>REM</code> keyword. This dates back to (at least) the late 1970's, and ''should'' work with most BASICs available today:
 
<langsyntaxhighlight lang="gwbasic">100 REM Standard BASIC comments begin with "REM" (remark) and extend to the end of the line
110 PRINT "this is code": REM comment after statement</langsyntaxhighlight>
 
{{works with|Applesoft BASIC}}
Line 324 ⟶ 344:
{{works with|QBasic|1.1}}
{{works with|QuickBASIC|4.5}}
{{works with|uBasic/4tH}}
Most BASICs also support alternate comment characters,
commonly an apostrophe (single quote):
 
<langsyntaxhighlight lang="qbasic"> 'this is a comment
PRINT "this is code" 'comment after statement</langsyntaxhighlight>
 
{{works with|DarkBASIC}}
Line 349 ⟶ 370:
==={{header|Applesoft BASIC}}===
Comment by making a REMark using the REM keyword
<langsyntaxhighlight lang="qbasic">REM COMMENT AFTER THE REM KEYWORD</langsyntaxhighlight>
When LISTing the program a space is added after the REM keyword
<langsyntaxhighlight lang="qbasic">0 REMLEAVE THE SPACE OUT AFTER THE REM WHEN TYPING OR PASTING</langsyntaxhighlight>
The remark extends until the end of the line. Only the first THIS IS CODE is printed.
<langsyntaxhighlight lang="qbasic">10 PRINT "THIS IS CODE" : REM : PRINT "THIS IS CODE"</langsyntaxhighlight>
A comment can come after a GOSUB and when the subroutine returns it continues running the statements after the GOSUB comment.
<langsyntaxhighlight lang="qbasic">20 GOSUB 110COMMENT: PRINT "THIS IS CODE"</langsyntaxhighlight>
Anything after a GOTO or RETURN statement is ignored.
<langsyntaxhighlight lang="qbasic">30 GOTO 40"COMMENT: THIS IS A COMMENT</langsyntaxhighlight>
There are other ways to add spacing and comments to code.
<langsyntaxhighlight lang="qbasic">::::::::::::::::::::::::::::::::::::::
40 REM
50 :
Line 366 ⟶ 387:
70 FOR I = 1 to 10
80 ::::PRINT I;MID$("THIS IS A COMMENT",1,0)
90 NEXT</langsyntaxhighlight>
Typing CONTinue after the program ENDs will result in a ?SYNTAX ERROR.
<syntaxhighlight lang ="qbasic">100 END : THISISACOMMENT</langsyntaxhighlight>
Use the quotation symbol " before the comment so that spaces are included and keywords are ignored.
<langsyntaxhighlight lang="qbasic">110 RETURN : "COMMENT FOR AND AT THE END</langsyntaxhighlight>
==={{header|BaCon}}===
BaCon accepts '''REM''' (or single quote apostrophe) for line comments.
Line 379 ⟶ 400:
 
==={{header|BASIC256}}===
<langsyntaxhighlight BASIC256lang="basic256">rem this is a comment
# and this is too
print "this is code" #comment after statement</langsyntaxhighlight>
 
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
<syntaxhighlight lang="qbasic">10 rem this is a comment
20 ' and this is too
30 print "this is code" : 'comment after statement
40 print "and more code" : rem comment after statement</syntaxhighlight>
 
==={{header|IS-BASIC}}===
<langsyntaxhighlight ISlang="is-BASICbasic">100 REM Standard BASIC comments begin with "REM" (remark) and extend to the end of the line
110 PRINT "this is code" ! comment after statement</langsyntaxhighlight>
 
==={{header|Minimal BASIC}}===
<syntaxhighlight lang="qbasic">10 REM STANDARD BASIC COMMENTS BEGIN WITH "REM" AND EXTEND TO THE END OF LINE
20 END</syntaxhighlight>
 
==={{header|MSX Basic}}===
<syntaxhighlight lang="qbasic">10 rem this is a comment
20 ' and this is too
30 print "this is code" : '[:] it's optional
40 print "and more code" : rem comment after statement</syntaxhighlight>
 
==={{header|Quite BASIC}}===
<syntaxhighlight lang="qbasic">10 rem this is a comment
20 print "this is code" : rem comment after statement</syntaxhighlight>
 
==={{header|True BASIC}}===
<langsyntaxhighlight lang="qbasic">!this is a comment
PRINT "this is code" !comment after statement</langsyntaxhighlight>
 
==={{header|XBasic}}===
{{works with|Windows XBasic}}
{{works with|Linux XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "Comments"
VERSION "0.0000"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
'this is a comment
PRINT "this is code" 'comment after statement
END FUNCTION
END PROGRAM</syntaxhighlight>
 
==={{header|Yabasic}}===
<langsyntaxhighlight lang="yabasic">rem Hey, this is a comment
# the hash-sign too (at beginning of line)
// even the double slash
Line 399 ⟶ 455:
print "Not a comment":// But this is again a valid comment
print "Not a comment" // even this.
print "Not a comment" rem and this !</langsyntaxhighlight>
 
=={{header|Batch File}}==
<syntaxhighlight lang ="dos">rem Single-line comment.</langsyntaxhighlight>
 
There is another (undocumented) option, using a double-colon <code>::</code>. However, this has issues with some syntactic constructs and therefore may raise syntax errors.
<langsyntaxhighlight lang="dos">:: Another option, though undocumented and known
:: to fail in some cases. Best avoided.</langsyntaxhighlight>
 
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 <code>%</code>.
<langsyntaxhighlight lang="dos">% this works as long as you have no variable named exactly like this sentence. %</langsyntaxhighlight>
Since comment lines are skipped entirely by the parser, multi-line comments aren't possible even with line continuation.
 
=={{header|BBC BASIC}}==
<langsyntaxhighlight lang="bbcbasic"> REM This is a comment which is ignored by the compiler
*| This is a comment which is compiled but ignored at run time</langsyntaxhighlight>
 
=={{header|bc}}==
<langsyntaxhighlight lang="bc">/* This is a comment. */
 
2 + /* Comment between tokens. */ 3
Line 427 ⟶ 483:
* of the comment are only for style. You must not nest a comment
* inside another comment; the first asterisk-slash ends the comment.
*/</langsyntaxhighlight>
 
----
Line 433 ⟶ 489:
{{works with|OpenBSD bc}}
 
<langsyntaxhighlight lang="bc">#!/usr/bin/bc
 
# This form of comment is an extension, not part of standard bc.
Line 443 ⟶ 499:
 
a = 1 # The newline is not part of the comment.
b = 2 # So this line is a different statement.</langsyntaxhighlight>
 
=={{header|Beef}}==
 
<syntaxhighlight lang="csharp">//This is a comment.
//This is another comment.
 
/* This is also a comment. */
 
/* This is a
multi-line
comment */
</syntaxhighlight>
 
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.
 
 
<syntaxhighlight lang="csharp">static
{
/// Must be placed directly above the method, including attributes.
/// Using multiple lines like this is also fine. Both will be recognized.
[Optimize]
public static void DoAThing() {}
 
/// Documentation also works for types.
struct SomeStruct
{
/**
* Multiline comment with two ** at the start works in the same way.
*/
void PrivateMethod() {}
}
 
/**
* 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.
*/
public static void DoAnotherThing(int a, int b) {}
}
</syntaxhighlight>
 
=={{header|Befunge}}==
Line 451 ⟶ 549:
 
{{works with|Befunge|93}}
<langsyntaxhighlight lang="befunge">& read a number 2+ add two .@ display result and exit
^- inline comments -^ <-^- other comments</langsyntaxhighlight>
 
{{works with|Befunge|98}}
<langsyntaxhighlight lang="befunge">&;read a number;2+;add two;.@;display result and exit;
^- inline comments -^ <-^- other comments
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;completely isolated comment block for the paranoid;
;(almost - you can still skip into it.) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</langsyntaxhighlight>
 
=={{header|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 in https://rosettacode.org/wiki/Documentation#Binary_Lambda_Calculus
 
=={{header|Blast}}==
 
<langsyntaxhighlight lang="blast"># A hash symbol at the beginning of a line marks the line as a comment
</syntaxhighlight>
</lang>
 
=={{header|BQN}}==
<syntaxhighlight lang ="bqn"># This is a comment</langsyntaxhighlight>
 
=={{header|Bracmat}}==
Line 474 ⟶ 576:
 
=={{header|Brainf***}}==
<syntaxhighlight lang ="bf">This is a comment</langsyntaxhighlight>
 
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).
 
=={{header|Brat}}==
<langsyntaxhighlight lang="brat"># Single line comment
 
#* Multi
Line
Comment *#</langsyntaxhighlight>
 
=={{header|Bruijn}}==
Bruijn does not have multi-line comments.
<syntaxhighlight lang="bruijn"># This is a comment</syntaxhighlight>
 
=={{header|Brlcad}}==
 
<langsyntaxhighlight lang="brlcad">
# Comments in mget scripts are prefixed with a hash symbol
ls # comments may appear at the end of a line
</syntaxhighlight>
</lang>
 
=={{header|Burlesque}}==
Line 496 ⟶ 602:
Burlesque does NOT have comments. However, you can comment code by pushing a string and popping it immediately.
 
<langsyntaxhighlight lang="burlesque">
"I'm sort of a comment"vv
</syntaxhighlight>
</lang>
 
Since strings are multi-line strings:
 
<langsyntaxhighlight lang="burlesque">
"I'm a
very long comment spanning
over several lines"vv
</syntaxhighlight>
</lang>
 
=={{header|C}}==
<langsyntaxhighlight lang="c">/* This is a comment. */
/* So is this
multiline comment.
*/</langsyntaxhighlight>
The comment starts at the <tt>/*</tt>, and ends at the <tt>*/</tt>. A comment may be used between any tokens. It cannot be used inside tokens, that is, given the code
<langsyntaxhighlight lang="c">struct charisma {};
void f(char/* comment */isma) {}</langsyntaxhighlight>
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
<langsyntaxhighlight lang="c">/* some comment /* trying to nest some other comment */ inside */</langsyntaxhighlight>
the comment ends at the first <tt>*/</tt>, and <tt>inside */</tt> 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:
<langsyntaxhighlight lang="c">#if 0
While technically not a comment, this is also ignored by the compiler
#endif</langsyntaxhighlight>
The trick is that 0 is always false, therefore the text between <tt>#if 0</tt> and <tt>#endif</tt> 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:
<langsyntaxhighlight lang="c">#ifdef UNDEFINED
This is not compiled.
#if 0
Line 535 ⟶ 641:
#endif
And this still is not compiled.
#endif</langsyntaxhighlight>
 
{{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 is ''not'' valid:
<langsyntaxhighlight lang="c">#if 0
This isn't valid.
#endif</langsyntaxhighlight>
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.
 
Line 548 ⟶ 654:
 
{{works with|C99}}
<langsyntaxhighlight lang="c">// C++ single-line comments were adopted in the C99 standard.</langsyntaxhighlight>
 
=={{header|C sharp|C#}}==
 
<langsyntaxhighlight lang="csharp">//This is a comment.
//This is other comment.
 
Line 559 ⟶ 665:
/* This is a
multi-line
comment */</langsyntaxhighlight>
 
=={{header|C++}}==
Line 565 ⟶ 671:
 
Single line C++-style comments
<syntaxhighlight lang ="cpp">// This is a comment</langsyntaxhighlight>
C++-style comments start with <tt>//</tt> 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:
<langsyntaxhighlight lang="cpp">// This is a valid comment // with a "nested" comment</langsyntaxhighlight>
That's because starting with the first <tt>//</tt> everything in the line is ignored, including the second <tt>//</tt>.
The fact that the newline is ''not'' part of the comment is important for multi-line macro definitions. It means that in the code
<langsyntaxhighlight lang="cpp">#define FOO \
(macro text) // comment
(no more macro text)</langsyntaxhighlight>
the line <tt>(no more macro text)</tt> is ''not'' 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 the ''comment'' instead. Comments inside macros therefore have to be C-style.
 
=={{header|Chapel}}==
<langsyntaxhighlight lang="chapel">// single line
 
/* multi
line */</langsyntaxhighlight>
 
=={{header|Chef}}==
<langsyntaxhighlight Cheflang="chef">Comment Stew.
 
This is a comment.
Line 597 ⟶ 703:
Methods.
SingleWordCommentTwo until SingleWordCommentOned.
Methods.</langsyntaxhighlight>
 
=={{header|ChucK}}==
<syntaxhighlight lang="chuck">
<lang ChucK>
<-- Not common
// Usual comment
</syntaxhighlight>
</lang>
 
=={{header|Clean}}==
Clean comments are similar to C++.
<langsyntaxhighlight lang="clean">Start = /* This is a multi-
line comment */ 17 // This is a single-line comment</langsyntaxhighlight>
In contrast to C++ comments can be nested.
<langsyntaxhighlight lang="clean">Start = /* This is a comment /* Nested comment */ still a comment */ 17</langsyntaxhighlight>
 
=={{header|Clojure}}==
Line 616 ⟶ 722:
Anything from a semicolon to the end of a line is a comment.
 
<langsyntaxhighlight lang="lisp">;; This is a comment
(defn foo []
123) ; also a comment</langsyntaxhighlight>
 
The <code>(comment)</code> macro will prevent a form from being evaluated, returning <code>nil</code> no matter what is contained in the comment. However the forms inside the <code>comment</code> form must be properly parseable (parentheses balanced, etc.) or an exception will be thrown.
 
<langsyntaxhighlight lang="lisp">(comment (println (foo)) "bar" :baz 123 (System/exit 0)) ;; does nothing, returns nil</langsyntaxhighlight>
 
Finally, the <code>#_</code> reader macro will cause a form to be ignored by the reader. Unlike <code>(comment)</code>, this does not return <code>nil</code>; the surrounding code is evaluated as though the ignored form isn't even there.
 
<langsyntaxhighlight lang="lisp">(+ 1 (comment "foo") 3) ;; Throws an exception, because it tries to add nil to an integer
(+ 1 #_"foo" 3) ;; Returns 4</langsyntaxhighlight>
 
=={{header|CMake}}==
 
Line comments use the common <code>#</code> syntax:
 
<syntaxhighlight lang="cmake"># A single-line comment</syntaxhighlight>
 
Multi-line comments use a Lua-like square-bracket syntax.
 
<syntaxhighlight lang="cmake">
#[[A multi-line
comment ]]
#[==[A multi-line comment
with [[nested brackets]]. ]==]</syntaxhighlight>
 
The number of equals signs (<code>=</code>) in the opening bracket determines the number expected in the closing bracket.
 
=={{header|COBOL}}==
=== Fixed format ===
<langsyntaxhighlight lang="cobol"> * an asterisk in 7th column comments the line out</langsyntaxhighlight>
A D in the 7th column indicates a debugging line which is treated like a comment unless a compiler flag is set.
<langsyntaxhighlight lang="cobol"> D DISPLAY "Debug"</langsyntaxhighlight>
 
=== Free format ===
<langsyntaxhighlight lang="cobol">*> This comment syntax was defined (with free format code) in COBOL 2002.</langsyntaxhighlight>
 
{{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.
<langsyntaxhighlight lang="cobol">>>D DISPLAY "Debug"</langsyntaxhighlight>
 
=== <code>NOTE</code> 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.
<langsyntaxhighlight lang="cobol"> NOTE this paragraph is
commented out and ignored
.</langsyntaxhighlight>
 
=== <code>REMARKS</code> and other statements ===
Line 653 ⟶ 775:
There are quite a few <code>IDENTIFICATION DIVISION</code> obsolete and extension reserved words that will work in GnuCOBOL 2.
 
<syntaxhighlight lang="cobol">
<lang COBOL>
IDENTIFICATION DIVISION.
PROGRAM-ID. program.
Line 665 ⟶ 787:
DATE-COMPILED. same.
DATE-MODIFIED. this one is handy when auto-stamped by an editor.
</langsyntaxhighlight> 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.
 
=={{header|CoffeeScript}}==
<langsyntaxhighlight lang="coffeescript"># one line comment
 
### multi
line
comment ###</langsyntaxhighlight>
 
=={{header|ColdFusion}}==
In tags:
<langsyntaxhighlight lang="cfm">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. --></langsyntaxhighlight>
 
In script:
<langsyntaxhighlight lang="cfm">/* This is a comment */
// This is also a comment</langsyntaxhighlight>
 
=={{header|Common Lisp}}==
Line 693 ⟶ 815:
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.
 
<langsyntaxhighlight lang="lisp">;;;; This code implements the foo and bar functions
 
;;; The foo function calls bar on the first argument and multiplies the result by the second.
Line 704 ⟶ 826:
;;; The bar function simply adds 3 to the argument
(defun bar (n)
(+ n 3))</langsyntaxhighlight>
 
However, comments should not be used for inline documentation, as most defining constructs permit a documentation string (which is then available at runtime). <!-- It would be better to make the above example not do this, instead of showing bad style -->
 
<langsyntaxhighlight lang="lisp">(defun bar (n)
"Add 3 to the argument."
(+ n 3))
Line 714 ⟶ 836:
(defclass button (widget)
(label action)
(:documentation "This is a push-button widget."))</langsyntaxhighlight>
 
=={{header|Component Pascal}}==
<langsyntaxhighlight lang="oberon2">
(* Comments (* can nest *)
and they can span multiple lines.
*)
</syntaxhighlight>
</lang>
 
=={{header|Crystal}}==
<langsyntaxhighlight lang="ruby"># 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`
class Foo
end</langsyntaxhighlight>
 
=={{header|D}}==
<langsyntaxhighlight lang="d">void main() {
// A single line comment.
 
Line 753 ⟶ 875:
Nestable documenttion comment.
+/
}</langsyntaxhighlight>
 
=={{header|Dart}}==
 
<langsyntaxhighlight lang="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 -> */
Line 769 ⟶ 891:
///
/// Formatting [variable] and [function] names like so allows dartdoc to link to the documentation for those entities.
</syntaxhighlight>
</lang>
 
=={{header|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.
<langsyntaxhighlight lang="dc">[Making and discarding a string acts like a comment] sz</langsyntaxhighlight>
GNU dc added the comment syntax of many other scripting languages.
<langsyntaxhighlight lang="dc"># remainder of line is a comment</langsyntaxhighlight>
 
=={{header|Delphi}}==
Line 781 ⟶ 903:
 
In addition to Pascal, Delphi also allows C++ style single line comments:
<syntaxhighlight lang ="delphi">// single line comment</langsyntaxhighlight>
 
=={{header|Deluge}}==
Line 787 ⟶ 909:
Comments are only allowed in places such as "on load" scripts. You cannot put them in form or view definitions.
 
<syntaxhighlight lang ="deluge">// single line comment</langsyntaxhighlight>
 
=={{header|Dragon}}==
<langsyntaxhighlight lang="dragon">// This is a comment </langsyntaxhighlight>
 
<langsyntaxhighlight lang="dragon">/*
This is
a multiple
line comment.
*/</langsyntaxhighlight>
 
<langsyntaxhighlight lang="dragon">
 
showln "Hello " /* This is an inline comment */ "world"
 
</syntaxhighlight>
</lang>
 
=={{header|DWScript}}==
<langsyntaxhighlight lang="delphi">(* This is a comment.
It may extend across multiple lines. *)
 
Line 814 ⟶ 936:
are supported */
 
// and single-line C++ style comments too</langsyntaxhighlight>
 
=={{header|Dyalect}}==
 
<langsyntaxhighlight lang="dyalect">/* This is a
multi-line comment */
 
//This is a single-line comment</langsyntaxhighlight>
 
=={{header|Dylan}}==
<langsyntaxhighlight Dylanlang="dylan">// This is a comment
 
/*
Line 830 ⟶ 952:
that spans multiple
lines
*/</langsyntaxhighlight>
 
=={{header|Déjà Vu}}==
<langsyntaxhighlight lang="dejavu">#this is a comment
!print "this is not a comment, obviously" #this is a comment as well</langsyntaxhighlight>
 
=={{header|E}}==
 
<langsyntaxhighlight lang="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."]</langsyntaxhighlight>
 
All comments span to the end of the line; there are no paired-delimiter comment syntaxes. “<code>#</code>” begins a comment anywhere outside of quotes; “<code>?</code>” and “<code>&gt;</code>” begin comments only if they are at the beginning of a line (except for whitespace), because those characters are also used for infix operators.
Line 850 ⟶ 972:
 
=={{header|EasyLang}}==
<syntaxhighlight lang="text"># This is a comment</langsyntaxhighlight>
 
=={{header|EchoLisp}}==
<langsyntaxhighlight lang="lisp">
666 ; this is an end-of-line comment
 
Line 868 ⟶ 990:
(info 'mynumber "👀 Symbols may be commented with an information string 👺")
(info 'mynumber) → displays the above inside the 'info' field.
</syntaxhighlight>
</lang>
 
=={{header|ECL}}==
 
Single-line comments must begin with //
<langsyntaxhighlight ECLlang="ecl">// this is a one-line comment </langsyntaxhighlight>
 
Block comments must be delimited with /* and */
 
<langsyntaxhighlight ECLlang="ecl"> /* this is a block comment - the terminator can be on the same line
or any succeeding line – everything in between is ignored */</langsyntaxhighlight>
 
=={{header|Ecstasy}}==
Comments in Ecstasy follow the two forms used by most C-family languages:
<syntaxhighlight lang="java">
/*
* This is a multi-line comment.
*/
Int i = 0; // This is an end-of-line comment
</syntaxhighlight>
 
=={{header|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.
<langsyntaxhighlight lang="edsac">[This is a comment]
[
And so
Line 889 ⟶ 1,020:
this
]
[But in 1949 they wouldn't have been]</langsyntaxhighlight>
 
=={{header|EGL}}==
Line 896 ⟶ 1,027:
=={{header|Eiffel}}==
 
<langsyntaxhighlight Eiffellang="eiffel">-- inline comment, continues until new line</langsyntaxhighlight>
 
=={{header|Ela}}==
 
<langsyntaxhighlight Elalang="ela">//single line comment
 
/*multiple line
comment*/</langsyntaxhighlight>
 
=={{header|Elena}}==
<langsyntaxhighlight lang="elena">//single line comment
 
/*multiple line
comment*/</langsyntaxhighlight>
 
=={{header|Elixir}}==
Elixir does not have multiple line comments.
<langsyntaxhighlight lang="elixir">
# single line comment
</syntaxhighlight>
</lang>
 
=={{header|Elm}}==
<langsyntaxhighlight lang="elm">
-- a single line comment
 
Line 924 ⟶ 1,055:
{- can be nested -}
-}
</syntaxhighlight>
</lang>
 
=={{header|Emacs Lisp}}==
A comment is started by <code>;</code> and reaches to the end of the line.
<syntaxhighlight lang ="lisp">; This is a comment</langsyntaxhighlight>
 
There are some coding conventions for <code>;;</code> align to indentation, <code>;;;</code> sections, etc,
Line 935 ⟶ 1,066:
 
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:
<langsyntaxhighlight lang="lisp">"This is effectively a comment,
if used at a place where the result is ignored"</langsyntaxhighlight>
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.
<langsyntaxhighlight lang="lisp">(defun subtract-second-from-first (x y)
"This function subtracts its second argument from its first argument."
(- y x))</langsyntaxhighlight>
Due to this, it's debatable if the string at that place can be considered as comment.
 
=={{header|EMal}}==
<syntaxhighlight lang="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.|^
 
</syntaxhighlight>
 
=={{header|Erlang}}==
 
<langsyntaxhighlight lang="erlang">% Erlang comments begin with "%" and extend to the end of the line.</langsyntaxhighlight>
 
=={{header|ERRE}}==
<syntaxhighlight lang="erre">
<lang ERRE>
! Standard ERRE comments begin with ! and extend to the end of the line
 
PRINT("this is code") ! comment after statement
</syntaxhighlight>
</lang>
 
=={{header|Euphoria}}==
Single line comment:
<syntaxhighlight lang Euphoria="euphoria">-- This is a comment</langsyntaxhighlight>
 
 
Multiline C-style comment:
<syntaxhighlight lang="euphoria">/*
<lang Euphoria>/*
This is a comment
*/</langsyntaxhighlight>
{{works with|Euphoria|4.0.0}}
 
=={{header|F_Sharp|F#}}==
F# accepts C++ type line comments and OCaml type block comments
<langsyntaxhighlight lang="fsharp">// this comments to the end of the line
(* this comments a region
which can be multi-line *)</langsyntaxhighlight>
 
=={{header|Factor}}==
<langsyntaxhighlight lang="factor">! Comments starts with "! "
#! Or with "#! "
! and last until the end of the line
Line 978 ⟶ 1,123:
USE: multiline
/* The multiline vocabulary implements
C-like multiline comments. */</langsyntaxhighlight>
 
=={{header|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 (/*...*/).
<langsyntaxhighlight lang="falcon">
/* Start comment block
My Life Story
Line 989 ⟶ 1,134:
// set up my bank account total
bank_account_total = 1000000 // Wish this was the case
</syntaxhighlight>
</lang>
 
=={{header|FALSE}}==
<langsyntaxhighlight lang="false">{comments are in curly braces}</langsyntaxhighlight>
 
=={{header|Fancy}}==
 
<langsyntaxhighlight lang="fancy"># Comments starts with "#"
# and last until the end of the line
</syntaxhighlight>
</lang>
 
=={{header|Fennel}}==
<syntaxhighlight lang="fennel">; This is a single-line comment</syntaxhighlight>
 
=={{header|Fermat}}==
<langsyntaxhighlight lang="fermat">Function Foo(n) =
{Comments within a function are enclosed within curly brackets.}
{You can make multi-line comments
Line 1,012 ⟶ 1,160:
 
Function Bar(n) =
2n-1.</langsyntaxhighlight>
 
=={{header|Fish}}==
Since ><> is a funge-like language, all characters not touched by the command pointer or modified by the <tt>p</tt> and <tt>g</tt> commands can be comments.
Unlike Brainf***, unknown commands are not ignored by the compiler, they just raise an error.
<langsyntaxhighlight Fishlang="fish">v This is the Fish version of the Integer sequence task
>0>:n1+v all comments here
^o" "< still here
And of course here :)</langsyntaxhighlight>
 
=={{header|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.
<langsyntaxhighlight lang="forth">\ The backslash skips everything else on the line
( The left paren skips everything up to the next right paren on the same line)</langsyntaxhighlight>
 
Traditionally, the paren comments are used for "stack effect" notation:
<langsyntaxhighlight lang="forth">: myword ( a b -- c ) ...</langsyntaxhighlight>
 
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:
<langsyntaxhighlight lang="forth">: add'em ( a b -- a+b ) + ;
: strlen ( addr -- len ) count nip ;</langsyntaxhighlight>
 
Some Forth systems implement other commenting words, such as these words from Win32Forth:
<langsyntaxhighlight lang="forth">\s skips all remaining text in the file
(( skips until the next double-paren,
stretching across multiple lines ))
Line 1,046 ⟶ 1,194:
enddoc
/* C-style comment */
(* Pascal-style comment *)</langsyntaxhighlight>
 
=={{header|Fortran}}==
Line 1,054 ⟶ 1,202:
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:
 
<langsyntaxhighlight lang="fortran">C This would be some kind of comment
C Usually one would avoid columns 2-6 even in a comment.</langsyntaxhighlight>
 
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:
 
<langsyntaxhighlight lang="fortran">C If compiled in debugging mode, print the current value of I
D PRINT *, I</langsyntaxhighlight>
 
ISO Fortran 90 or later have an inline comment (!) syntax:
 
<langsyntaxhighlight lang="fortran">real :: a = 0.0 ! initialize A to be zero</langsyntaxhighlight>
 
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 (!).
Line 1,070 ⟶ 1,218:
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:
 
<langsyntaxhighlight lang="fortran">?? if (.false.) then
do while (oh_no)
a = bad_news()
Line 1,076 ⟶ 1,224:
c = gigo()
end do
?? end if</langsyntaxhighlight>
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
' This a single line comment
Line 1,097 ⟶ 1,245:
'/
like this
'/</langsyntaxhighlight>
 
=={{header|Frink}}==
<langsyntaxhighlight lang="frink">
// This is a single-line comment
/* This is a comment
Line 1,106 ⟶ 1,254:
and so on.
*/
</syntaxhighlight>
</lang>
 
=={{header|Futhark}}==
 
<syntaxhighlight lang="futhark">
<lang Futhark>
-- Single-line comment
 
-- Multi-line
-- comment (yes, just several single-line comments).
</syntaxhighlight>
</lang>
 
=={{header|FutureBasic}}==
<langsyntaxhighlight lang="futurebasic">
// Single line comment
' Single line comment
rem Single line comment
/* Single line comment */
Line 1,128 ⟶ 1,275:
comment
*/
</syntaxhighlight>
</lang>
 
=={{header|FUZE BASIC}}==
<langsyntaxhighlight lang="qbasic">//Comment (No space required)
# Comment (Space required)
REM Comment (Space require)
PRINT "This is an inline comment."//Comment (No space required)
END</langsyntaxhighlight>
 
=={{header|Gambas}}==
Line 1,141 ⟶ 1,288:
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:
 
<langsyntaxhighlight lang="gambas">
' This whole line is a comment and is ignored by the gambas interpreter
print "Hello" ' Comments after an apostrophe are ignored
Line 1,148 ⟶ 1,295:
' FIXME: Fix Me comment will appear in Task Bar
' NOTE: Note commnet will appear in Task Bar
</syntaxhighlight>
</lang>
 
=={{header|GAP}}==
<langsyntaxhighlight lang="gap"># Comment (till end of line)</langsyntaxhighlight>
 
=={{header|gecho}}==
<langsyntaxhighlight lang="gecho">( this is a test comment... o.O ) 1 2 + .</langsyntaxhighlight>
 
=={{header|Gema}}==
<langsyntaxhighlight lang="gama">! comment starts with "!" and continues to end of line</langsyntaxhighlight>
A shebang (#!) may be used as a comment in the first line of a file.
 
=={{header|Genie}}==
Genie allows comments in code in two different ways.
<langsyntaxhighlight lang="genie">// Comment continues until end of line
 
/* Comment lasts between delimiters */</langsyntaxhighlight>
 
Delimited comments cannot be nested.
Line 1,170 ⟶ 1,317:
=={{header|GML}}==
single-line comment:
<langsyntaxhighlight GMLlang="gml"> // comment starts with "//" and continues to the end of the line</langsyntaxhighlight>
 
multi-line comment:
<langsyntaxhighlight GMLlang="gml"> /* 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
*/</langsyntaxhighlight>
 
=={{header|gnuplot}}==
<langsyntaxhighlight lang="gnuplot"># this is a comment
 
# backslash continues \
a comment to the next \
line or lines</langsyntaxhighlight>
 
The way backslash continues a comment means that comments can't usefully be put within a multi-line function definition,
 
<langsyntaxhighlight lang="gnuplot"># this doesn't work
foo(n) = (n \
+ 2 # no good \
Line 1,195 ⟶ 1,342:
 
# behaves as if you wrote merely
foo(n) = (n+2</langsyntaxhighlight>
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">// this is a single line comment
/* this is
a multi-line
block comment.
/* It does not nest */</langsyntaxhighlight>
 
=={{header|Golfscript}}==
<syntaxhighlight lang ="golfscript"># end of line comment</langsyntaxhighlight>
 
=={{header|Gri}}==
<code>#</code> through to newline.
 
<langsyntaxhighlight Grilang="gri"># this is a comment
show 123 # this too is a comment</langsyntaxhighlight>
 
<code>//</code> works similarly but is reckoned the "old way" (as of Gri 2.12.23)
 
<syntaxhighlight lang="text">// this is a comment
show 123 // this too is a comment</langsyntaxhighlight>
 
Both forms can be used in input data files too.
Line 1,226 ⟶ 1,373:
{{works with|GW-BASIC}}
 
<langsyntaxhighlight lang="gwbasic">100 REM Standard BASIC comments begin with "REM" (remark) and extend to the end of the line
110 PRINT "this is code": REM comment after statement</langsyntaxhighlight>
 
=={{header|Haskell}}==
<langsyntaxhighlight lang="haskell">i code = True -- I am a comment.
 
{- I am also
Line 1,244 ⟶ 1,391:
This is a Haddock documentation block comment
-}
i code = True</langsyntaxhighlight>
 
=={{header|Haxe}}==
<langsyntaxhighlight lang="haxe">// Single line commment.
 
/*
Line 1,253 ⟶ 1,400:
line
comment.
*/</langsyntaxhighlight>
 
=={{header|HicEst}}==
<langsyntaxhighlight lang="hicest">! a comment starts with a "!" and ends at the end of the line</langsyntaxhighlight>
 
=={{header|Hope}}==
<langsyntaxhighlight lang="hope">! All Hope comments begin with "!" and extend to the end of the line</langsyntaxhighlight>
 
=={{header|HTML}}==
<langsyntaxhighlight lang="html5"><!-- Anything within these bracket tags is commented, single or multi-line. --></langsyntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
Any text after "#" is a comment.
<langsyntaxhighlight Iconlang="icon"># This is a comment
 
procedure x(y,z) #: This is a comment and an IPL meta-comment for a procedure
</syntaxhighlight>
</lang>
The [[:Category:Icon_Programming_Library|The 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.
 
Line 1,276 ⟶ 1,423:
The comment character in IDL is the semicolon - everything starting with it and to the end of the line is a comment. Like this:
<langsyntaxhighlight lang="idl">; The following computes the factorial of a number "n"
fact = product(indgen( n )+1) ; where n should be an integer</langsyntaxhighlight>
 
=={{header|Inform 7}}==
<langsyntaxhighlight lang="inform7">[This is a single-line comment.]
 
[This is a
multi-line comment.]
 
[Comments can [be nested].]</langsyntaxhighlight>
 
=={{header|Insitux}}==
<syntaxhighlight lang="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 scope
which can also stretch across
multiple lines"
 
(do "if you're desperate, using do will make sure this string will not be returned also"
(+ 2 2))
</syntaxhighlight>
 
=={{header|Intercal}}==
<langsyntaxhighlight lang="intercal">PLEASE NOTE This is a comment</langsyntaxhighlight>
 
=={{header|Io}}==
<langsyntaxhighlight lang="io"># Single-line comment
 
// Single-line comment
 
/* Multi-line
comment */</langsyntaxhighlight>
 
=={{header|Isabelle}}==
<langsyntaxhighlight Isabellelang="isabelle">theory Text
imports Main
begin
Line 1,305 ⟶ 1,466:
(* Top-level Isar comment. *)
 
end</langsyntaxhighlight>
 
=={{header|J}}==
<langsyntaxhighlight lang="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 : 0
Line 1,320 ⟶ 1,483:
)
 
{{)n
'A simple string which is not used is legal, and will be discarded'</lang>
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).
}}</syntaxhighlight>
 
=={{header|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===
<langsyntaxhighlight lang="java">/* This is a comment */</langsyntaxhighlight>
 
<langsyntaxhighlight lang="java">/*
* This is
* a multiple
* line comment.
*/</langsyntaxhighlight>
This ''C-style'' comment starts with <tt>/*</tt> and ends with <tt>*/</tt>.
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)===
<syntaxhighlight lang ="java">// This is a comment</langsyntaxhighlight>
This ''C++-style'' comment starts with <tt>//</tt> and extends to the end of line.
 
===Java Documentation (Javadoc)===
<langsyntaxhighlight lang="java">/** This is a Javadoc comment */</langsyntaxhighlight>
 
<langsyntaxhighlight lang="java">/**
* This is
* a multiple
* line Javadoc comment
*/</langsyntaxhighlight>
[http://en.wikipedia.org/wiki/Javadoc 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 this [http://stackoverflow.com/questions/4448180/why-does-java-permit-escaped-unicode-characters-in-the-source-code discussion on why it's allowed].
<langsyntaxhighlight lang="java">public class JustComments {
/*
\u002A\u002F\u0070\u0075\u0062\u006C\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063
Line 1,360 ⟶ 1,533:
\u002B\u0022\u0020\u0057\u006F\u0072\u006C\u0064\u0021\u0022\u0029\u003B\u007D\u002F\u002A
*/
}</langsyntaxhighlight>
 
=={{header|JavaScript}}==
<langsyntaxhighlight lang="javascript">n = n + 1; // This is a comment</langsyntaxhighlight>
<langsyntaxhighlight lang="javascript">// This is a valid comment // with a "nested" comment</langsyntaxhighlight>
<langsyntaxhighlight lang="javascript">/* This is
a multi line
comment
// with a "nested" comment
and another line in the comment
*/</langsyntaxhighlight>
 
=={{header|JCL}}==
first form
<syntaxhighlight lang="jcl">
<lang JCL>
//* This is a comment line (//* in columns 1-3)
</syntaxhighlight>
</lang>
second form
<syntaxhighlight lang="jcl">
<lang JCL>
/* This is also a comment line (/* in columns 1-3)
</syntaxhighlight>
</lang>
 
=={{header|Joy}}==
<langsyntaxhighlight lang="joy"># this is a single line comment
 
(* this is a
multi-line comment *)</langsyntaxhighlight>
 
Multi-line comments cannot be nested.
Line 1,392 ⟶ 1,565:
=={{header|jq}}==
Except when a hash symbol (#) appears within a string, it begins a comment that continues to the end of the line:
<langsyntaxhighlight lang="jq"># this is a single line comment
"Hello #world" # the first # on this line is part of the jq program
</syntaxhighlight>
</lang>
 
=={{header|Jsish}}==
<langsyntaxhighlight lang="javascript">#!/usr/bin/env/jsish
/* Comments, in Jsish */
 
Line 1,424 ⟶ 1,597:
PASS!: err = can not execute expression: 'noname' not a function
=!EXPECTEND!=
*/</langsyntaxhighlight>
 
{{out}}
Line 1,438 ⟶ 1,611:
 
=={{header|Julia}}==
<langsyntaxhighlight Julialang="julia"># single line
 
#=
Line 1,444 ⟶ 1,617:
line
comment
=#</langsyntaxhighlight>
 
=={{header|K}}==
<langsyntaxhighlight Klang="k"> / this is a comment
2+2 / as is this
</syntaxhighlight>
</lang>
 
=={{header|KonsolScript}}==
 
<langsyntaxhighlight KonsolScriptlang="konsolscript">//This is a comment.
//This is another comment.
 
Line 1,460 ⟶ 1,633:
/* This is a
multi-line
comment */</langsyntaxhighlight>
 
=={{header|Kotlin}}==
<langsyntaxhighlight lang="scala">// This is a single line comment
 
/*
Line 1,493 ⟶ 1,666:
println("Current stable version is $CURRENT_VERSION")
println("Next major version is $NEXT_MAJOR_VERSION")
}</langsyntaxhighlight>
 
=={{header|Lambdatalk}}==
<langsyntaxhighlight lang="scheme">
 
;; this is a comment on a single line
Out of bracketed expressions words are ignored by the lambdatalk evaluator and are dislayed as they are:
 
Hello World
-> Hello World
 
In 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
°°°
</syntaxhighlight>
</lang>
 
=={{header|LabVIEW}}==
{{VI solution|LabVIEW_Comments.png}}
 
=={{header|Lang}}==
Single line
<syntaxhighlight lang="lang5">
# This is a comment
</syntaxhighlight>
Multiline (Line continuation)
<syntaxhighlight lang="lang5">
# This is a comment\
with multiple lines
</syntaxhighlight>
Multiline (Multiline text sequence)
<syntaxhighlight lang="lang5">
# {{{This is a comment
which has more than
2 lines
and this one}}}
</syntaxhighlight>
 
=={{header|Lang5}}==
<syntaxhighlight lang Lang5="lang5"># This is a comment.</langsyntaxhighlight>
 
=={{header|langur}}==
Langur has 2 types of comments.
 
<langsyntaxhighlight lang="langur"># single line comment starts with hash mark
 
/* inline or multi-line comment uses C-style syntax */
</syntaxhighlight>
</lang>
 
As of 0.6.11, commentsComments allow characters designated as "Graphic" by Unicode, Spaces, and Private Use Area code points. Also, certain invisible "spaces," to make it easier to paste in international text (see langurlang.org). The idea around the "allowed" characters is to keep source code from having hidden text or codes and to allay confusion and deception.
 
=={{header|Lasso}}==
 
<langsyntaxhighlight Lassolang="lasso ">//This is a comment.
 
/* This is also a comment. */
Line 1,534 ⟶ 1,731:
A multi-line
comment
=========================== */</langsyntaxhighlight>
 
=={{header|LaTeX}}==
In LaTeX, comments look like this:
<langsyntaxhighlight lang="latex">\documentclass{minimal}
\begin{document}
% This is a comment
\end{document}</langsyntaxhighlight>
LaTeX comments start with <tt>%</tt> and continue up to ''and 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 the ''one'' word "understandable":
<langsyntaxhighlight lang="latex">\documentclass{minimal}
\newcommand{\firstpart}[1]{under#1}
\newcommand{\secondpart}{able}
Line 1,551 ⟶ 1,748:
\begin{document}
\complete
\end{document}</langsyntaxhighlight>
Without the percent sign after <tt>\firstpart{stand}</tt>, it would have been the ''two'' words "understand able".
 
=={{header|Liberty BASIC}}==
<langsyntaxhighlight lang="lb">'This is a comment
REM This is a comment
 
print "This has a comment on the end of the line." 'This is a comment
print "This also has a comment on the end of the line." : REM This is a comment</langsyntaxhighlight>
 
=={{header|Lily}}==
There are two kinds of comments:
 
<langsyntaxhighlight lang="lily"># This is a single-line comment</langsyntaxhighlight>
 
and
 
<langsyntaxhighlight lang="lily">#[ This
is
a
block
comment ]#</langsyntaxhighlight>
 
Like with C, block comments don't nest.
Line 1,578 ⟶ 1,775:
=={{header|Lilypond}}==
 
<langsyntaxhighlight lang="lilypond">% This is a comment
 
%{ This is a comment
spanning several lines %}</langsyntaxhighlight>
 
=={{header|Lingo}}==
In Lingo any line starting with "--" is a comment and ignored by the interpreter.
 
<langsyntaxhighlight lang="lingo">-- This is a comment.
-- This is another comment</langsyntaxhighlight>
 
=={{header|LiveCode}}==
<langsyntaxhighlight LiveCodelang="livecode">-- comment may appear anywhere on line
// comment may appear anywhere on line
# comment may appear anywhere on line
/* this is a
block comment that
may span any number of lines */</langsyntaxhighlight>
 
=={{header|Logo}}==
<langsyntaxhighlight lang="logo">; comments come after a semicolon, and last until the end of the line</langsyntaxhighlight>
 
=={{header|Logtalk}}==
<langsyntaxhighlight lang="logtalk">% single-line comment; extends to the end of the line</langsyntaxhighlight>
<langsyntaxhighlight lang="logtalk">/* multi-line
comment */</langsyntaxhighlight>
 
=={{header|LOLCODE}}==
<langsyntaxhighlight LOLCODElang="lolcode">OBTW This is a
multi line comment
TLDR</langsyntaxhighlight>
<langsyntaxhighlight LOLCODElang="lolcode">BTW This is a single line comment.</langsyntaxhighlight>
 
=={{header|LotusScript}}==
LotusScript has two ways to enter comments.
<syntaxhighlight lang ="lotusscript">' This is a comment</langsyntaxhighlight>
Wherever the single quote (<tt>'</tt>) 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.
<langsyntaxhighlight lang="lotusscript">%REM
This is a multi-
line comment.
%END REM</langsyntaxhighlight>
A <tt>%REM</tt> marker begins a comment block, and a <tt>%END REM</tt> 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.
 
=={{header|LSE}}==
<langsyntaxhighlight lang="lse">* Ceci est un commentaire qui prend fin quand la ligne se termine
 
(* Ceci est un commentaire sur plusieurs lignes
Line 1,628 ⟶ 1,825:
plusieurs lignes justement... *)
 
(* Cette exemple est selon la revision LSE-2000 *)</langsyntaxhighlight>
 
=={{header|LSE64}}==
<langsyntaxhighlight lang="lse64"># single line comment (space after # is required)</langsyntaxhighlight>
The author of LSE64 comments the stack effect of words with header comments as follows:
<langsyntaxhighlight lang="lse64"># arg1 arg2 '''yields''' result|''nothing''</langsyntaxhighlight>
 
=={{header|Lua}}==
 
<langsyntaxhighlight lang="lua">-- A single line comment
 
--[[A multi-line
comment --]]</langsyntaxhighlight>
 
{{works with|Lua|5.1 and above}}
<langsyntaxhighlight lang="lua">--[====[ A multi-line comment that can contain [[ many square brackets ]]
]====]</langsyntaxhighlight>
 
=={{header|M2000 Interpreter}}==
Multiline commend Ret { lines of code, or text }
There is no multi line comment. We have to use ' or \
 
Same line comment until end of line (can start immediate after a command: use ' or \ or //
There are three types of remarks. After statement with a dark color, in a line, with no statements, with the current pen color, and the Rem statement. Rem statement skip statements in current line, but m2000 editor render these using syntax highlight.
 
Rem (form start of code line)
<lang M2000 Interpreter>
 
(:\ and \\ or \) in a name can exist only for Dir statement:
 
dir c:\thatfolder
 
is the same as
 
dir "c:\thatfolder"
 
 
<syntaxhighlight lang="m2000 interpreter">
Module Comments {
Rem {
Print "ok" ' comment at the end of line
Print "no print here"
Print "ok" \ comment at the end of line
? "no print here either"
\ comment in one line - different color with previous two
}
'comment in one line
Rem : single line remark
Rem : Print "ok" ' statements after Rem skipped, but stay with syntax highlight
// 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 colon
Print "ok" ' single line
}
Comments
 
</syntaxhighlight>
</lang>
 
=={{header|M4}}==
 
<langsyntaxhighlight M4lang="m4">eval(2*3) # eval(2*3) "#" and text after it aren't processed but passed along
 
dnl this text completely disappears, including the new line
Line 1,672 ⟶ 1,887:
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</langsyntaxhighlight>
 
{{out}}
Line 1,681 ⟶ 1,896:
can separate it from preceding text if necessary
 
<langsyntaxhighlight lang="m4">some text`'dnl then a deleted comment</langsyntaxhighlight>
 
<code>changecom()</code> can set a different character for <code>#</code>,
 
<langsyntaxhighlight lang="m4">changecom(%)
% now percent prevents macro expansion</langsyntaxhighlight>
 
In GNU m4 an empty <code>changecom()</code> string means no such commenting char at all (but in BSD m4 means reset to the default <code>#</code>)
 
<langsyntaxhighlight lang="m4">changecom()
GNU m4 now no macro expansion suppression character at all</langsyntaxhighlight>
 
In GNU m4 <code>changecom()</code> also takes separate start and end strings and they can be multi-character sequences, allowing for example C style,
 
<langsyntaxhighlight lang="m4">changecom(/*,*/)
/* GNU m4 now no macro expansion in C style comments */</langsyntaxhighlight>
 
=={{header|Maple}}==
<langsyntaxhighlight Maplelang="maple">x := 4: x; # Everything on this line, after this, is a comment.
 
17; (* This
is
a multiline comment *) 23.4;</langsyntaxhighlight>
{{out}}
<pre>
Line 1,712 ⟶ 1,927:
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang Mathematica="mathematica">(*this is a comment*)</langsyntaxhighlight>
It can be used everywhere and nested if necessary:
<langsyntaxhighlight Mathematicalang="mathematica">If[a(*number 1*)<(* is smaller than number 2*) b, True (*return value (*bool true*)*), False (*return bool false*)]</langsyntaxhighlight>
evaluates to:
<langsyntaxhighlight Mathematicalang="mathematica">If[a < b, True, False]</langsyntaxhighlight>
 
=={{header|MATLAB}}==
 
<langsyntaxhighlight MATLABlang="matlab">%This is a comment
%% Two percent signs and a space are called a cell divider</langsyntaxhighlight>
 
=={{header|Maxima}}==
<langsyntaxhighlight lang="maxima">/* Comment
/* Nested comment */
*/</langsyntaxhighlight>
 
=={{header|MAXScript}}==
<langsyntaxhighlight lang="maxscript">-- Two dashes precede a single line comment
 
/* This is a
multi-line comment */</langsyntaxhighlight>
 
=={{header|MBS}}==
 
<langsyntaxhighlight lang="mbs">! A pling in a line starts a comment
 
INT 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 */</langsyntaxhighlight>
 
 
=={{header|MEL}}==
<syntaxhighlight lang="mel">// This is a single line comment</syntaxhighlight>
 
=={{header|Metafont}}==
<langsyntaxhighlight lang="metafont">% this is "to-end-of-line" comment</langsyntaxhighlight>
 
=={{header|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.
 
<langsyntaxhighlight lang="smallbasic">' This is a comment
i = i + 1 ' You can also append comments to statements</langsyntaxhighlight>
 
=={{header|min}}==
{{works with|min|0.19.3}}
<langsyntaxhighlight lang="min">; this is a comment
1 1 + ; add one and one together</langsyntaxhighlight>
 
=={{header|MiniScript}}==
MiniScript just has one kind of comment. They begin with two slashes, and extend to the
end of a line. So you can put a comment either on a line by itself, or after a statement.
<syntaxhighlight lang="miniscript">// How many roads must a man walk down?
x = 6 * 7 // forty-two</syntaxhighlight>
 
=={{header|Mirah}}==
<langsyntaxhighlight lang="mirah">puts 'code' # I am a comment
/* This is
* a multiple
* line comment */
</syntaxhighlight>
</lang>
 
=={{header|MIPS Assembly}}==
This is ultimately up to the assembler, but semicolons are typically the comment character for almost all assemblers.
<langsyntaxhighlight lang="mips">;this is a comment
li $t0,0x1234 ;this is also a comment</langsyntaxhighlight>
 
However, MARS and QTSPIM use the <code>#</code>.
<syntaxhighlight lang="mips"># this is a comment
li $t0,0x1234 # this is also a comment</syntaxhighlight>
 
=={{header|mIRC Scripting Language}}==
<langsyntaxhighlight lang="mirc">;Single Line Comment
/*
Multiple
Line
Comment
*/</langsyntaxhighlight>
 
=={{header|Modula-2}}==
<langsyntaxhighlight Modulalang="modula-2">(* Comments (* can nest *)
and they can span multiple lines.
*)</langsyntaxhighlight>
 
=={{header|Modula-3}}==
<langsyntaxhighlight lang="modula3">(* Comments (* can nest *)
and they can span multiple lines.
*)</langsyntaxhighlight>
 
=={{header|Monte}}==
 
<syntaxhighlight lang="monte">
<lang Monte>
# This comment goes to the end of the line
/** This comment is multi-line.
Line 1,795 ⟶ 2,024:
and ends with only one.
These should only be used for docstrings. */
</syntaxhighlight>
</lang>
 
=={{header|MontiLang}}==
 
<syntaxhighlight lang="montilang">
<lang MontiLang>
/# This is a comment #/
/#
comments can span multiple lines
nested comments are not supported #/
</syntaxhighlight>
</lang>
 
=={{header|MOO}}==
<langsyntaxhighlight lang="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 */</langsyntaxhighlight>
 
=={{header|Nanoquery}}==
Comments in Nanoquery must be on a single line.
<langsyntaxhighlight Nanoquerylang="nanoquery">// this is a comment
// this is also a comment</langsyntaxhighlight>
 
=={{header|NATURAL}}==
<langsyntaxhighlight NATURALlang="natural">* This is a comment and extends to the end of the line </langsyntaxhighlight>
 
=={{header|Neko}}==
<langsyntaxhighlight ActionScriptlang="actionscript">// Single line comment, of course!
 
/*
Line 1,829 ⟶ 2,058:
Documentation block
<doc>can include XML parsed nodes between doc tags</doc>
**/</langsyntaxhighlight>
 
=={{header|Nemerle}}==
<langsyntaxhighlight Nemerlelang="nemerle">// This comment goes up to the end of the line
/* This
is
a
multiline
comment */</langsyntaxhighlight>
 
=={{header|NESL}}==
<langsyntaxhighlight lang="nesl">% This is a comment. %</langsyntaxhighlight>
 
=={{header|NetRexx}}==
NetRexx supports block-comments and line comments. Block comments are started with a <code>'''/*'''</code> and terminated with a <code>'''*/'''</code>. Line comments follow a <code>'''--'''</code> sequence anywhere on a line.
NetRexx supports nested comments (see [[#REXX|REXX]]).
<syntaxhighlight lang="netrexx">/*
<lang NetRexx>/*
 
NetRexx comment block
Line 1,853 ⟶ 2,082:
-- NetRexx line comment
 
</syntaxhighlight>
</lang>
 
=={{header|NewLISP}}==
A comment is started by <code>;</code> and reaches to the end of the line.
<syntaxhighlight lang ="lisp">; This is a comment</langsyntaxhighlight>
 
=={{header|Nim}}==
<langsyntaxhighlight Pythonlang="python"># Nim supports single-line comments
 
var x = 0 ## Documentation comments start with double hash characters.
Line 1,875 ⟶ 2,104:
discard """This can be considered as a "comment" too
This is multi-line"""
</syntaxhighlight>
</lang>
 
=={{header|Nix}}==
<langsyntaxhighlight lang="nix"># This comment goes up to the end of the line
/* This
is
a
multiline
comment */</langsyntaxhighlight>
 
=={{header|NSIS}}==
<langsyntaxhighlight lang="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
Line 1,893 ⟶ 2,122:
multi-line
comment */
</syntaxhighlight>
</lang>
 
=={{header|Oberon-2}}==
<langsyntaxhighlight lang="oberon2">
(* this is a comment *)
(*
Line 1,903 ⟶ 2,132:
(* with a nested comment *)
*)
</syntaxhighlight>
</lang>
 
=={{header|Objeck}}==
<langsyntaxhighlight lang="objeck">
#This is a comment.
# This is other comment.
Line 1,915 ⟶ 2,144:
multi-line
comment ~#
</syntaxhighlight>
</lang>
 
=={{header|Objective-C}}==
Line 1,922 ⟶ 2,151:
=={{header|OCaml}}==
<langsyntaxhighlight lang="ocaml">(* This a comment
(* containing nested comment *)
*)
 
(** This an OCamldoc documentation comment *)</langsyntaxhighlight>
 
=={{header|Octave}}==
<langsyntaxhighlight lang="octave"># I am a comment till the end of line
% I am a comment till the end of line
 
Line 1,936 ⟶ 2,165:
multiple lines
%}
</syntaxhighlight>
</lang>
 
=={{header|Oforth}}==
Oforth has only single line comment (inside or outside definition)
 
<langsyntaxhighlight Oforthlang="oforth">// This is a comment...</langsyntaxhighlight>
 
=={{header|ooRexx}}==
Comments in ooRexx follow the same rules as [[#REXX|REXX]] and [[#NetRexx|NetRexx]]
 
<syntaxhighlight lang="oorexx">/*
<lang ooRexx>/*
Multi-line comment block
*/
Line 1,956 ⟶ 2,185:
hour = 12 /* time for lunch! works as well (and really everywhere) */
 
</syntaxhighlight>
</lang>
 
=={{header|Openscad}}==
 
The openscad geometry compiler supports C++ style comments:
<langsyntaxhighlight lang="openscad">
// This is a single line comment
 
Line 1,969 ⟶ 2,198:
*/
 
</syntaxhighlight>
</lang>
 
=={{header|OxygenBasic}}==
<langsyntaxhighlight lang="oxygenbasic">
' Basic line comment
; Assembly code line comment
// C line comment
/* C block comment */
</syntaxhighlight>
</lang>
 
=={{header|Oz}}==
<langsyntaxhighlight lang="oz">% one line comment
 
%% often with double "%" because then the indentation is correct in Emacs
Line 1,987 ⟶ 2,216:
comment
*/
</syntaxhighlight>
</lang>
 
=={{header|PARI/GP}}==
Line 1,993 ⟶ 2,222:
 
=={{header|Pascal}}==
<langsyntaxhighlight lang="pascal">(* This is a comment.
It may extend across multiple lines. *)
 
Line 2,002 ⟶ 2,231:
but not valid in [[Turbo Pascal]]. }
 
{ The same is true in this case *)</langsyntaxhighlight>
 
In Pascal, comments cannot be nested.
Line 2,008 ⟶ 2,237:
=={{header|PASM}}==
 
<langsyntaxhighlight lang="pasm"># This is a comment
print "Hello\n" # This is also a comment
end</langsyntaxhighlight>
 
=={{header|Peloton}}==
Peloton encloses all comments inside <@ OMT></@> (fixed length opcode) or <# OMIT></#> (variable length opcode) whether single- or multi- line.
<langsyntaxhighlight lang="html">
<@ OMT>This is a
multiline
comment</@>
</syntaxhighlight>
</lang>
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.
 
Line 2,025 ⟶ 2,254:
Single line comment
 
<syntaxhighlight lang ="perl"># this is commented</langsyntaxhighlight>
 
These may also be at the end of a line
 
<langsyntaxhighlight lang="perl">my $var = 1; # this is the comment part</langsyntaxhighlight>
 
Multi-line comments for inline documentation (Plain Old Documentation, or POD in Perl parlance) follow the format:
 
<langsyntaxhighlight lang="perl">=pod
 
Here are my comments
this is multi-line
 
=cut</langsyntaxhighlight>
 
Note that technically, both of the lines beginning with the equals sign must be surrounded on either side for compatibility with all "POD" parsers.
Line 2,044 ⟶ 2,273:
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:
 
<langsyntaxhighlight lang="perl">=head1
=head4
=over 4
=Any Old String</langsyntaxhighlight>
 
Such blocks always end in =cut.
Line 2,056 ⟶ 2,285:
{{libheader|Phix/basics}}
Single line comment:
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">-- Thisthis is a comment.
// this is also a comment. </span>
<!--</lang>-->
<!--</syntaxhighlight>-->
 
Nestable multiline comments:
<!--<langsyntaxhighlight Phixlang="phix">-->
<span style="color: #000080;font-style:italic;">/*
This is a comment
Line 2,072 ⟶ 2,302:
*/</span>
<span style="color: #7060A8;">puts<span style="color: #0000FF;">(<span style="color: #000000;">1<span style="color: #0000FF;">,<span style="color: #008000;">"this is not a comment"<span style="color: #0000FF;">)
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
this is not a comment
</pre>
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
 
=={{header|PHP}}==
Single line comment:
 
<langsyntaxhighlight lang="php"># this is commented
// this is commented</langsyntaxhighlight>
 
These may also be at the end of a line:
 
<langsyntaxhighlight lang="php">$var = 1; # this is the comment part
$var = 1; // this is the comment part</langsyntaxhighlight>
 
Basic syntax for multi-line comments:
 
<langsyntaxhighlight lang="php">/*
Here are my comments
this is multi-line
*/</langsyntaxhighlight>
 
Note that; it is more common to see phpDocumentor styled multi-lined comments:
 
<langsyntaxhighlight lang="php">/**
* phpdoc Comments
* @todo this is a todo stub
*/</langsyntaxhighlight>
 
=={{header|Picat}}==
{{works with|Picat}}
<syntaxhighlight lang="picat">
<lang Picat>
/*
* Multi-line comment
Line 2,111 ⟶ 2,348:
 
% Single-line Prolog-style comment
</syntaxhighlight>
</lang>
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp"># The rest of the line is ignored
#{
This is a
Line 2,125 ⟶ 2,362:
This is typically used conditionally, with a read-macro expression like
`*Dbg
so that this text is only read if in debugging mode.</langsyntaxhighlight>
 
=={{header|Pike}}==
<langsyntaxhighlight lang="pike">// This is a comment.
/* This is a
multi
Line 2,134 ⟶ 2,371:
comment */
 
int e = 3; // end-of-statement comment.</langsyntaxhighlight>
 
=={{header|PL/I}}==
<langsyntaxhighlight lang="pli">/* This is a comment. */</langsyntaxhighlight>
<langsyntaxhighlight lang="pli">/*
This is a multiline comment.
*/</langsyntaxhighlight>
Note: In PL/I, comments cannot be nested.
 
Line 2,146 ⟶ 2,383:
Single line comment:
 
<langsyntaxhighlight lang="plsql">--this is a single line comment</langsyntaxhighlight>
 
Multiline comment:
 
<langsyntaxhighlight lang="plsql">/*
this is a multiline
comment
*/</langsyntaxhighlight>
 
End of line comment:
 
<langsyntaxhighlight lang="plsql">v_var number; --this is an end of line comment</langsyntaxhighlight>
 
=={{header|Plain English}}==
<langsyntaxhighlight lang="plainenglish">\A comment like this lasts until the end of the line
Put 1 plus [there are inline comments too] 1 into a number.</langsyntaxhighlight>
 
=={{header|plainTeX}}==
Line 2,169 ⟶ 2,406:
it; so the % starts a to-end-of-line comment in many TeX macro packages.
 
<langsyntaxhighlight lang="tex">% this is a comment
This is not.</langsyntaxhighlight>
 
The final newline character is eaten and since it normally behaves like a space, the comment can
be used to hide the newline:
 
<langsyntaxhighlight lang="tex">\def\firstpart#1{under#1}
\def\secondpart{able}
\def\complete{\firstpart{stand}%
\secondpart}
 
\complete</langsyntaxhighlight>
 
Outputs <tt>understandable</tt>; without % it would output <tt>understand able</tt>.
Line 2,189 ⟶ 2,426:
begins with tree consecutive semicolons and ends at the end of line:
 
<langsyntaxhighlight lang="pop11">;;; This is a comment</langsyntaxhighlight>
 
C-like comments may be multiline:
 
<langsyntaxhighlight lang="pop11">/* First line
Second line */</langsyntaxhighlight>
 
C-like comments (unlike C) may be nested:
 
<langsyntaxhighlight lang="pop11">/* This is a comment /* containing nested comment */ */</langsyntaxhighlight>
 
One can also use conditional compilation to comment out sections of code
 
<langsyntaxhighlight lang="pop11">#_IF false
some code
#_ENDIF</langsyntaxhighlight>
 
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:
 
<langsyntaxhighlight lang="pop11">#_IF false
This w'ont work
#_ENDIF</langsyntaxhighlight>
 
because apostrophe starts an unterminated string.
 
=={{header|PostScript}}==
<syntaxhighlight lang="text">
%This is a legal comment in PostScript
</syntaxhighlight>
</lang>
 
=={{header|PowerShell}}==
<syntaxhighlight lang ="powershell"># single-line comment</langsyntaxhighlight>
 
{{works with|PowerShell|2}}
<langsyntaxhighlight lang="powershell"><# multi-line
comment #></langsyntaxhighlight>
 
=={{header|Processing}}==
<langsyntaxhighlight lang="java">// a single-line comment
 
/* a multi-line
Line 2,243 ⟶ 2,480:
// comment at the end of a line
println("foo bar"); // "baz"</langsyntaxhighlight>
 
==={{header|Processing Python mode}}===
 
<langsyntaxhighlight lang="python"># a single-line comment
"""
Line 2,262 ⟶ 2,499:
println("foo bar") # "baz"
 
# there is no way to make an inline comment</langsyntaxhighlight>
 
=={{header|ProDOS}}==
I don't know why this is even a task because it should be included in any decent programming language.
<syntaxhighlight lang ProDOS="prodos">IGNORELINE your text here</langsyntaxhighlight>
 
=={{header|Prolog}}==
<langsyntaxhighlight lang="prolog">% this is a single-line comment that extends to the end of the line</langsyntaxhighlight>
<langsyntaxhighlight lang="prolog">/* This is a
multi-line comment */</langsyntaxhighlight>
 
=={{header|PureBasic}}==
PureBasic uses the ";" symbol to mark its comments. All text entered after ";" on a line is ignored by the compiler.
<langsyntaxhighlight PureBasiclang="purebasic">;comments come after an unquoted semicolon and last until the end of the line
foo = 5 ;This is a comment
c$ = ";This is not a comment" ;This is also a comment</langsyntaxhighlight>
 
=={{header|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.
 
<langsyntaxhighlight lang="python"># This is a comment
foo = 5 # You can also append comments to statements</langsyntaxhighlight>
 
Certain 'do nothing' expressions resemble comments
 
<langsyntaxhighlight lang="python">"""Un-assigned strings in triple-quotes might be used
as multi-line comments
"""
Line 2,295 ⟶ 2,532:
of other quote marks without any need to \escape\ them using any special characters. They also may span multiple
lines without special escape characters.
'''</langsyntaxhighlight>
 
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.
Line 2,302 ⟶ 2,539:
 
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:
<langsyntaxhighlight lang="python">#!/usr/bin/env python
# Example of using doc strings
"""My Doc-string example"""
Line 2,318 ⟶ 2,555:
print (Foo.__doc__)
print (Foo.__init__.__doc__)
print (bar.__doc__)</langsyntaxhighlight>
 
 
Line 2,328 ⟶ 2,565:
 
=={{header|Quackery}}==
<syntaxhighlight lang="quackery">
 
<lang Quackery>
( The word "(" is a compiler directive (a builder,
in Quackery jargon) that causes the compiler to
Line 2,350 ⟶ 2,586:
The word "commentary" will cause the compiler to
disregard everything that comes after it to the
end of the source string or file.</langsyntaxhighlight>
 
 
=={{header|QB64}}==
''CBTJD'': 2020/03/12
<langsyntaxhighlight lang="qb64">REM This is a remark...
' This is also a remark...
 
Line 2,365 ⟶ 2,601:
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.</langsyntaxhighlight>
 
=={{header|R}}==
<syntaxhighlight lang ="rsplus"># end of line comment</langsyntaxhighlight>
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">; this is a to-end-of-line coment
<lang racket>
; this is a to-end-of-line coment
 
#| balanced comment, #| can be nested |# |#
Line 2,379 ⟶ 2,614:
 
#; ; the following expression is commented because of the #; in the beginning
(ignored)</syntaxhighlight>
 
</lang>
 
=={{header|Raku}}==
Line 2,390 ⟶ 2,623:
A single-line comment starts with # and extends to the end of the line.
 
<syntaxhighlight lang="raku" perl6line># the answer to everything
my $x = 42;</langsyntaxhighlight>
 
'''Multi-line comments'''
Line 2,397 ⟶ 2,630:
A multi-line comment starts with #` and followed by the commented text enclosed by bracketing characters (e.g., (), [], {}, 「」, etc.).
 
<syntaxhighlight lang="raku" perl6line>#`(
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;</langsyntaxhighlight>
 
Multi-line comments can also be embedded into code.
 
<syntaxhighlight lang="raku" perl6line>for #`(each element in) my @array {
say #`(or print element) $_ #`(with a newline);
}</langsyntaxhighlight>
 
Using more than one bracketing character lets you include an unmatched close bracket, as shown below.
 
<syntaxhighlight lang="raku" perl6line>#`{{
This close curly brace } won't terminate the comment early.
}}</langsyntaxhighlight>
 
'''Pod comments'''
 
<syntaxhighlight lang="raku" perl6line>=begin comment
 
Pod 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</langsyntaxhighlight>
 
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.
 
<syntaxhighlight lang="raku" perl6line>#| Compute the distance between two points in the plane.
sub distance(
Rat \x1, #= First point's abscissa,
Line 2,435 ⟶ 2,668:
){
return sqrt((x2 - x1)**2 + (y2 - y1)**2)
}</langsyntaxhighlight>
 
=={{header|Rapira}}==
Comments in Rapira are preceded by a backslash (\).
<syntaxhighlight lang="rapira">\ This is a Rapira comment.</syntaxhighlight>
 
=={{header|Raven}}==
<syntaxhighlight lang="raven"> # this is a comment</syntaxhighlight>
 
<lang raven> # this is a comment</lang>
 
=={{header|REBOL}}==
<syntaxhighlight lang="rebol">; This is a line comment.
 
<lang REBOL>
; This is a line comment.
 
{ Multi-line strings can
be used as comments
if you like }
</syntaxhighlight>
</lang>
 
Functions have special commenting options which make them self documenting:
 
<syntaxhighlight lang="rebol">
<lang REBOL>
plus2: func [
"Adds two to a number."
Line 2,460 ⟶ 2,694:
n + 2
]
</syntaxhighlight>
</lang>
 
If you say "help plus2" at REBOL's REPL, you'll get this help information:
Line 2,475 ⟶ 2,709:
 
=={{header|Relation}}==
<syntaxhighlight lang="relation">
<lang Relation>
// This is a valid comment
// A space is needed after the double slash
</syntaxhighlight>
</lang>
 
=={{header|Retro}}==
<langsyntaxhighlight Retrolang="retro">( comments are placed between parentheses. A space must follow the opening parenthesis. )</langsyntaxhighlight>
 
=={{header|REXX}}==
Line 2,494 ⟶ 2,728:
 
Also, some REXX interpreters show the comment (if part of a REXX statement) as part of the information displayed when (if) a &nbsp; '''syntax''' &nbsp; error occurs and an informative error message is generated. &nbsp; For instance, in the program &nbsp; (named c:\COMMENTD.REX):
<langsyntaxhighlight lang="rexx">/*REXX program that demonstrates what happens when dividing by zero. */
y=7
say 44 / (7-y) /* divide by some strange thingy.*/</langsyntaxhighlight>
'''output''' &nbsp; when using the Regina REXX interpreter:'
<pre>
Line 2,520 ⟶ 2,754:
 
<br>Nested comments allow an easy way to comment large chunks of code where the commented-out code has its own comments.
<langsyntaxhighlight lang="rexx">/*REXX program to demonstrate various uses and types of comments. */
 
/* everything between a "climbstar" and a "starclimb" (exclusive of literals) is
Line 2,561 ⟶ 2,795:
/*not a real good place for a comment (above),
but essentially, a REXX comment can be
anywhere whitespace is allowed. */</langsyntaxhighlight>
 
A Classic REXX implementation (e.g. Regina) also allow line comments which start with a &nbsp; '''--''' &nbsp; sequence and extend to the end of the line:
Line 2,580 ⟶ 2,814:
 
 
<langsyntaxhighlight lang="rexx">-- A REXX line comment (maybe)
say "something" -- another line comment (maybe)</langsyntaxhighlight>
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.
 
=={{header|Ring}}==
in Ring language we can use // or # for one line comments:
<langsyntaxhighlight lang="ring">
//this is a single line comment
#this also a single line comment!
</syntaxhighlight>
</lang>
 
and for multi-line comments we use /* */:
<langsyntaxhighlight lang="ring">
/*This is a multi-line
comment that will be completely
ignored by the compiler/interpreter
*/
</syntaxhighlight>
</lang>
 
=={{header|RLaB}}==
Line 2,603 ⟶ 2,837:
RLaB only has single line comment indicator, as in following examples
 
<syntaxhighlight lang="rlab">
<lang RLaB>
x = "code" # I am a comment
x = "code" // Here I comment thee
# matlab-like document line
// C++ like document line
</syntaxhighlight>
</lang>
 
=={{header|Robotic}}==
Comments can only be created in one way:
<langsyntaxhighlight lang="robotic">
. "This is a comment line"
 
Line 2,619 ⟶ 2,853:
 
. "This is the only way to comment a line in Robotic"
</syntaxhighlight>
</lang>
 
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:
<langsyntaxhighlight lang="robotic">
. "@NewRobotName"
</syntaxhighlight>
</lang>
 
This would then change the robot's name from whatever it was before to "NewRobotName" instead.
 
=={{header|Rockstar}}==
<syntaxhighlight lang="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.)</syntaxhighlight>
=={{header|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 - <span style="color:grey">"swap the first 2 levels and subtract" DROP</span>
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 - <span style="color:grey">@ swap the first 2 levels and subtract </span>
 
=={{header|Ruby}}==
 
<langsyntaxhighlight lang="ruby">x = "code" # I am a comment
 
=begin hello
I a POD documentation comment like Perl
=end puts "code"</langsyntaxhighlight>
 
=={{header|Run BASIC}}==
Comments have a ' (single quote) or REM for remarks
<langsyntaxhighlight lang="runbasic">'This is a comment
REM This is a comment
print "Notice comment at the end of the line." 'This is a comment
print "Also notice this comment at the end of the line." : REM This is a comment
</syntaxhighlight>
</lang>
 
=={{header|Rust}}==
<langsyntaxhighlight lang="rust">// A single line comment
 
/*
Line 2,686 ⟶ 2,935:
(inner attributes are terminated by a semi-colon)
See also https://github.com/mozilla/rust/blob/master/doc/rust.md#attributes"];
}</langsyntaxhighlight>
 
=={{header|SAS}}==
<langsyntaxhighlight lang="sas">/* comment */
 
*another comment;
Line 2,696 ⟶ 2,945:
may
be
multiline;</langsyntaxhighlight>
 
=={{header|Sather}}==
<syntaxhighlight lang ="sather">-- a single line comment</langsyntaxhighlight>
 
=={{header|S-BASIC}}==
<syntaxhighlight lang="BASIC">
rem S-BASIC of course allows traditional BASIC-style comments
 
comment
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.
end
 
comment
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.
end
 
var 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
= real
 
comment
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
</syntaxhighlight>
 
=={{header|Scala}}==
 
<langsyntaxhighlight lang="scala">// A single line comment
 
/* A multi-line
comment */</langsyntaxhighlight>
 
=={{header|Scheme}}==
<langsyntaxhighlight lang="scheme">; Basically the same as Common Lisp
; While R5RS does not provide block comments, they are defined in SRFI-30, as in Common Lisp :
 
Line 2,718 ⟶ 3,005:
 
; See http://srfi.schemers.org/srfi-30/srfi-30.html
</syntaxhighlight>
</lang>
 
=={{header|Scilab}}==
Specify a comment starting with // to the end of line
<syntaxhighlight lang="text">// this is a comment
i=i+1 // this is a comment</langsyntaxhighlight>
 
=={{header|sed}}==
<syntaxhighlight lang ="sed"># a single line comment</langsyntaxhighlight>
 
=={{header|Seed7}}==
 
<langsyntaxhighlight lang="seed7"># A single line comment
 
(* A multi-line
Line 2,736 ⟶ 3,023:
 
(* In Seed7,
(* comments can be nested. *) *)</langsyntaxhighlight>
 
=={{header|SenseTalk}}==
<langsyntaxhighlight lang="sensetalk">
# Hashtag is a comment
-- Dash dash is another comment
Line 2,747 ⟶ 3,034:
blocks of code (* and can be nested *) *)
set foo to true // all comments can append to statements
</syntaxhighlight>
</lang>
 
=={{header|Set lang}}==
<langsyntaxhighlight lang="set_lang">> Comments start where a > (greater than symbol) starts
set a 0 > Comments may start after a Set command</langsyntaxhighlight>
 
=={{header|SETL}}==
<langsyntaxhighlight lang="setl">print("This is not a comment"); -- This is a comment
$ For nostalgic reasons, this is also a comment.</langsyntaxhighlight>
 
=={{header|Sidef}}==
Single line comment
<syntaxhighlight lang ="ruby"># this is commented</langsyntaxhighlight>
 
These may also be at the end of a line
<langsyntaxhighlight lang="ruby">var i = 1; # this is the comment part</langsyntaxhighlight>
 
Embedded comments
<langsyntaxhighlight lang="ruby">var distance #`{in meters} = (30 #`{meters} * 100 #`{seconds});
say distance; # prints: 3000</langsyntaxhighlight>
 
Multi-line comments
<langsyntaxhighlight lang="ruby">/*
This is a multi-line comment
*/</langsyntaxhighlight>
 
=={{header|Simula}}==
The same as Algol 60:
<syntaxhighlight lang="text">COMMENT This is a comment for Simula 67;</langsyntaxhighlight>
And an new form:
<syntaxhighlight lang="text">!This is a comment for Simula 67;</langsyntaxhighlight>
'''Pitfall''': it's ''not'' easy to ''comment-out'' parts of code:
<langsyntaxhighlight Simulalang="simula">!OutText("Dying."); !Outimage; !terminate_program;</langsyntaxhighlight>
 
=={{header|Slate}}==
<langsyntaxhighlight lang="slate">"basically the same as smalltalk"</langsyntaxhighlight>
 
=={{header|Smalltalk}}==
 
<langsyntaxhighlight lang="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."</langsyntaxhighlight>
 
=={{header|smart BASIC}}==
 
<syntaxhighlight lang="text">'Single line comments are preceded by a single quote or the command REM
 
PRINT "Hello" 'Single line comments may follow code
Line 2,814 ⟶ 3,101:
/* A comment can also follow another comment */ 'Like this
 
Some programmers like to do this to allow for /* Procedural comments */ followed by 'Programmer's notes.</langsyntaxhighlight>
 
=={{header|SNOBOL4}}==
 
<syntaxhighlight lang="snobol4">
<lang SNOBOL4>
* An asterisk in column 1 is the standard Snobol comment
* mechanism, marking the entire line as a comment. There
Line 2,837 ⟶ 3,124:
END
 
Any text after the required END label is ignored.</langsyntaxhighlight>
 
=={{header|SNUSP}}==
Line 2,848 ⟶ 3,135:
 
=={{header|SPL}}==
<langsyntaxhighlight lang="spl">'This is single-line comment
 
''This is
multiline comment''</langsyntaxhighlight>
 
=={{header|SQL}}==
Line 2,857 ⟶ 3,144:
 
The comment appears on the same line as the statement:
<langsyntaxhighlight lang="sql">SELECT * FROM mytable -- Selects all columns and rows</langsyntaxhighlight>
or before:
<langsyntaxhighlight lang="sql">-- Selects all columns and rows
SELECT * FROM mytable </langsyntaxhighlight>
or after:
<langsyntaxhighlight lang="sql">SELECT * FROM mytable
-- Selects all columns and rows</langsyntaxhighlight>
 
=={{header|SQL PL}}==
Line 2,869 ⟶ 3,156:
Single line comment:
 
<langsyntaxhighlight lang="sql pl">
--This is a single line comment.
</syntaxhighlight>
</lang>
 
Multiline comment:
 
<langsyntaxhighlight lang="sql pl">
/* This is
a multiline
comment */
</syntaxhighlight>
</lang>
 
Another way to do multiline comments
 
<langsyntaxhighlight lang="sql pl">
(= This is
a multiline
comment =)
</syntaxhighlight>
</lang>
 
End of line comment:
 
<langsyntaxhighlight lang="sql pl">
declare myvar number; --This is an end of line comment.
</syntaxhighlight>
</lang>
 
Comments work the same as in [[SQL]].
 
=={{header|Squirrel}}==
<langsyntaxhighlight lang="squirrel">//this is a single line comment
 
#this is also a single line comment
Line 2,904 ⟶ 3,191:
/*
this is a multi-line comment
*/</langsyntaxhighlight>
 
=={{header|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 to <tt>011 Test</tt> or <tt>111 Stop</tt>, even the address field is unused. In the case of a <tt>Sub.</tt> instruction, finally, the leftmost bit of the instruction field is disregarded: <tt>001</tt> and <tt>101</tt> 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
<syntaxhighlight lang ="ssem">00101010010001000100100100001100</langsyntaxhighlight>
will be understood by the machine as <tt>Add 20 to CI</tt>, a normal instruction. But it also fits four comment characters into the unused bits, employing a simple five-bit encoding where <tt>A</tt>=0 and <tt>Z</tt>=25. The instruction breaks down as follows:
 
Line 2,933 ⟶ 3,220:
=={{header|Standard ML}}==
<langsyntaxhighlight lang="sml">(* This a comment
(* containing nested comment *)
*)</langsyntaxhighlight>
 
=={{header|Stata}}==
<langsyntaxhighlight lang="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
Line 2,944 ⟶ 3,231:
/* Multiline comment
 
*/</langsyntaxhighlight>
 
=={{header|SuperTalk}}==
<syntaxhighlight lang="supertalk">-- This is a comment</syntaxhighlight>
 
=={{header|Swift}}==
<langsyntaxhighlight lang="swift">// this is a single line comment
/* This a block comment
/* containing nested comment */
Line 2,956 ⟶ 3,246:
/**
This is a documentation block comment
*/</langsyntaxhighlight>
 
=={{header|Symsyn}}==
<syntaxhighlight lang="symsyn">
<lang Symsyn>
| This is a comment
</syntaxhighlight>
</lang>
 
=={{header|Tcl}}==
Line 2,967 ⟶ 3,257:
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:
 
<langsyntaxhighlight lang="tcl"># comment on a line by itself. The next is a command by itself:
set var1 $value1
set var2 $value2 ; # comment that follows a line of code</langsyntaxhighlight>
 
The reason for the need for a semi-colon on a trailing comment is this:
Line 2,977 ⟶ 3,267:
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.)
 
<langsyntaxhighlight lang="tcl">set aList {foo}
lappend aList # bar
puts $aList ;# ==> prints "foo # bar"
puts [llength $aList] ;# ==> 3</langsyntaxhighlight>
 
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:
 
<langsyntaxhighlight lang="tcl">if 0 {
Comments...
}</langsyntaxhighlight>
 
=={{header|Tern}}==
Line 2,995 ⟶ 3,285:
 
One common approach is to put the comment in a string which is not stored anywhere:
<langsyntaxhighlight lang="ti83b">:"THIS IS A COMMENT</langsyntaxhighlight>
However this will change the Ans variable.
 
This approach, while messier, does not affect the Ans variable:
<langsyntaxhighlight lang="ti83b">:If 0
:THIS IS A COMMENT</langsyntaxhighlight>
 
=={{header|TI-89 BASIC}}==
 
<langsyntaxhighlight lang="ti89b">© This is a comment. Everything from © to the end of the line is ignored.</langsyntaxhighlight>
 
=={{header|Tiny BASIC}}==
 
<syntaxhighlight lang="tiny basic">
<lang Tiny BASIC>
10 REM this is a comment
20
Line 3,014 ⟶ 3,304:
40 REM from above you can see that line numbers with no statement
50 REM and blank lines also are ignored
</syntaxhighlight>
</lang>
 
=={{header|Toka}}==
Line 3,021 ⟶ 3,311:
a line, the shebang is normally used:
 
<langsyntaxhighlight lang="toka">#! Everything on this line (after the shebang to the left) will be ignored.</langsyntaxhighlight>
 
The shebang comments can not be used inside of functions.
Line 3,027 ⟶ 3,317:
In addition, Toka also accepts parenthetical comments. These are enclosed in parenthesis, and are often used for stack comments or comments inside functions.
 
<langsyntaxhighlight lang="toka">[ ( a b -- c )
... ] is myword</langsyntaxhighlight>
 
In addition, parenthetical comments can span multiple lines.
 
<langsyntaxhighlight lang="toka">( This is a
simple, multi-line
comment )</langsyntaxhighlight>
 
Since comments are provided by actual functions, the comment function must be whitespace delimited, just as with all other functions in Toka.
Line 3,040 ⟶ 3,330:
A final way to include text in a file is to mark a false ending with '''end.'''
 
<langsyntaxhighlight lang="toka">... code ....
end.
Nothing following the end. will be evaluated by Toka.</langsyntaxhighlight>
 
=={{header|TorqueScript}}==
 
<syntaxhighlight lang TorqueScript="torquescript">//This is a one line comment. There are no other commenting options in TorqueScript.</langsyntaxhighlight>
 
=={{header|TPP}}==
 
<langsyntaxhighlight lang="tpp">--## comments are prefixed with a long handed double paintbrush</langsyntaxhighlight>
 
 
=={{header|Transd}}==
<langsyntaxhighlight lang="scheme">// This is a line comment.
/* This is a single line block comment.*/
/* This is
a multi-line
block comment.*/
</syntaxhighlight>
</lang>
 
=={{header|TUSCRIPT}}==
<langsyntaxhighlight lang="tuscript">
$$ MODE TUSCRIPT
- This is a comment
</syntaxhighlight>
</lang>
 
=={{header|TXR}}==
 
<langsyntaxhighlight lang="txr">@# old-style comment to end of line
@; new-style comment to end of line
@(bind a ; comment within expression
"foo")</langsyntaxhighlight>
 
=={{header|UNIX Shell}}==
Line 3,078 ⟶ 3,368:
{{works with|Korn Shell}}
 
<langsyntaxhighlight lang="bash">#!/bin/sh
# A leading hash symbol begins a comment.
echo "Hello" # Comments can appear after a statement.
Line 3,084 ⟶ 3,374:
# The hash symbol must be at the beginning of a word.
echo This_Is#Not_A_Comment
#Comment</langsyntaxhighlight>
 
==={{header|C Shell}}===
<langsyntaxhighlight lang="csh">#!/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.</langsyntaxhighlight>
 
==={{header|es}}===
<langsyntaxhighlight lang="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.</langsyntaxhighlight>
 
=={{header|Unlambda}}==
Line 3,117 ⟶ 3,407:
=={{header|Ursa}}==
Comments in Ursa must be on a single line, and are denoted by a #
<langsyntaxhighlight lang="ursa"># this is a comment
# this is another comment
</syntaxhighlight>
</lang>
 
=={{header|Ursala}}==
There are lots of ways to have comments in Ursala.
Here are the conventional ones.
<langsyntaxhighlight Ursalalang="ursala"># this is single line a comment
 
# this is a\
Line 3,140 ⟶ 3,430:
###
The whole rest of the file after three hashes
is a comment.</langsyntaxhighlight>
 
=== Commenting out code ===
Line 3,147 ⟶ 3,437:
An individual item of a syntactically correct list or aggregate is commented
out like this.
<langsyntaxhighlight Ursalalang="ursala">x = <1,## 2,3></langsyntaxhighlight>
The 2 is ignored but 1 and 3 aren't. This also works with
nested aggregates and multiple lines.
<syntaxhighlight lang="ursala">a =
<lang Ursala>a =
 
<
Line 3,159 ⟶ 3,449:
'not',
'to',
## 'be'></langsyntaxhighlight>
A syntactically correct declaration can be commented out like this.
<langsyntaxhighlight Ursalalang="ursala">foo = 1
 
##
Line 3,167 ⟶ 3,457:
bar = 2
 
baz = 3</langsyntaxhighlight>
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.
Line 3,175 ⟶ 3,465:
to embed comments in executable files and libraries it generates without
affecting their semantics.
<langsyntaxhighlight Ursalalang="ursala">#comment -[
I document the source text but will also be embedded in
the output library or executable file.]-
 
#comment gpl'3'</langsyntaxhighlight>
The latter comment puts the standard GPL license notification in the output file.
 
Line 3,186 ⟶ 3,476:
A function f annotated with a crash dump wrapper expressed like this
during debugging
<syntaxhighlight lang Ursala="ursala">my_input_type%C f</langsyntaxhighlight>
is equivalent to just f when changed to this in the production code.
<syntaxhighlight lang Ursala="ursala">my_input_type%Ck f</langsyntaxhighlight>
 
=== Comments as hooks ===
Line 3,194 ⟶ 3,484:
Compiling with the --depend command line option makes the compiler only scan for the #depend'ed
expressions and send them to standard output.
<langsyntaxhighlight Ursalalang="ursala">#depend <this,expression> is (parsed)* but {
otherwise,
ignored}</langsyntaxhighlight>
This way, scripts and source management tools can have information passed to them from
the programmer by running the compiler instead of re-implementing their own parsers.
Line 3,202 ⟶ 3,492:
=={{header|VBA}}==
A comment starts with a quote (') and it ends at end of line
<langsyntaxhighlight lang="vb">' This is a VBA comment
</syntaxhighlight>
</lang>
 
=={{header|VBScript}}==
A comment starts with a quote (') and it ends at end of line
<langsyntaxhighlight lang="vb">' This is a VBScript comment
</syntaxhighlight>
</lang>
 
=={{header|Verbexx}}==
<langsyntaxhighlight lang="verbexx">
//////////////////////////////////////////////////////////////////////////////////////////////
//
Line 3,304 ⟶ 3,594:
| |
\=================================================================================================/
</syntaxhighlight>
</lang>
 
=={{header|Verilog}}==
<langsyntaxhighlight Veriloglang="verilog">// Single line commment.
/*
Line 3,313 ⟶ 3,603:
line
comment.
*/</langsyntaxhighlight>
 
=={{header|VHDL}}==
<langsyntaxhighlight lang="vhdl">-- Single line commment in VHDL</langsyntaxhighlight>
 
=={{header|Vim Script}}==
Line 3,323 ⟶ 3,613:
In most cases, " will also work after a command (i.e. the rest of the line will be ignored). But some commands like <code>echo</code> treat the whole line as their argument and thus will raise an error (''Missing quote'').
 
<langsyntaxhighlight lang="vim">let a = 4 " A valid comment
echo "foo" " Not a comment but an argument that misses the closing quote</langsyntaxhighlight>
 
=={{header|Visual Basic}}==
Line 3,330 ⟶ 3,620:
In addition to the methods mentioned in [[#BASIC|BASIC]] above, it is also somewhat common to effectively comment out code by including the unwanted code inside an <code>#If 0 ... #End If</code> block. (This works because 0 evaluates to False in VB.) Note, however, that the IDE will complain about actual comments inside an <code>#If 0</code> block unless it's also commented normally (i.e., using <code>Rem</code> or <code>'</code>).
 
<langsyntaxhighlight lang="vb">'comment
Rem comment
#If 0
Line 3,336 ⟶ 3,626:
IDE won't. Note the somewhat odd formatting seen here; the IDE will likely
just mark the entire line(s) as errors.
#End If</langsyntaxhighlight>
 
=={{header|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.
 
<langsyntaxhighlight lang="vbnet">' This is a comment
REM This is also a comment
Dim comment as string ' You can also append comments to statements
Dim comment2 as string REM You can append comments to statements</langsyntaxhighlight>
 
=={{header|Visual Objects}}==
<langsyntaxhighlight lang="visualfoxpro">
// This is a comment
/* This is a comment */
Line 3,354 ⟶ 3,644:
NOTE This is a commen
 
</syntaxhighlight>
</lang>
 
=={{header|V (Vlang)}}==
<pre>
// This is a single line comment.
Line 3,367 ⟶ 3,657:
=={{header|Vorpal}}==
 
<syntaxhighlight lang ="vorpal"># single line comment</langsyntaxhighlight>
 
=={{header|Wart}}==
 
<syntaxhighlight lang ="wart"># single-line comment</langsyntaxhighlight>
 
=={{header|Wren}}==
<langsyntaxhighlight ecmascriptlang="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.*/</langsyntaxhighlight>
 
 
=={{header|X10}}==
Line 3,386 ⟶ 3,675:
 
All text from the ASCII characters “//” to the end of line is considered a comment and is ignored.
<langsyntaxhighlight X10lang="x10">// This is a single line comment
 
/*
This comment spans
multiple lines
*/</langsyntaxhighlight>
 
=={{header|XLISP}}==
<syntaxhighlight lang ="xlisp">; this is a comment</langsyntaxhighlight>
 
=={{header|Xojo}}==
 
<syntaxhighlight lang="vb">
<lang VB>
// 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 blocks
Dim foo As Integer // Comments can also occupy the ends of code lines</langsyntaxhighlight>
 
=={{header|XPL0}}==
Line 3,407 ⟶ 3,696:
always terminates a comment. Consequently there is no multi-line
comment. For example:
<langsyntaxhighlight XPL0lang="xpl0">Text(0, \comment\ "Hello \not a comment\ World!"); \comment</langsyntaxhighlight>
 
Since backslashes toggle comments on and off, it could be inconvenient to
comment out a line of code that contains a comment. For example, two
additional backslashes could be used to comment out this line, as shown here:
<langsyntaxhighlight XPL0lang="xpl0"> Text(0, "Hello World"); \comment
\Text(0, "Hello World"); \\comment</langsyntaxhighlight>
 
However, two backslashes together comment out everything to the end of
the line regardless of any backslashes the line might contain. So the
first example could be commented out like this:
<langsyntaxhighlight XPL0lang="xpl0">\\Text(0, \comment\ "Hello \not a comment\ World"); \comment</langsyntaxhighlight>
 
Conditional compilation can be used to effectively comment out multiple
lines of code. For example:
<langsyntaxhighlight XPL0lang="xpl0">cond false;
Text(0, "Hello World"); \comment
CrLf(0);
cond true;</langsyntaxhighlight>
 
=={{header|XQuery}}==
<langsyntaxhighlight lang="xquery">(: This is a XQuery comment :)</langsyntaxhighlight>
 
=={{header|XSLT}}==
<langsyntaxhighlight lang="xml"><!-- Comment syntax is borrowed from XML and HTML. --></langsyntaxhighlight>
 
=={{header|XUL}}==
 
<langsyntaxhighlight lang="xul"><!-- Comment syntax is borrowed from XML and HTML. --></langsyntaxhighlight>
 
=={{header|Yacas}}==
Yacas supports C++ style comments:
<langsyntaxhighlight Yacaslang="yacas">// This is a single line comment
/*
This comment spans
multiple lines
*/</langsyntaxhighlight>
 
=={{header|Z80 Assembly}}==
Note: syntax depends on the assembler software but use of a semicolon is fairly standard. VASM and WinAPE use the semicolon.
<langsyntaxhighlight lang="z80"> ld hl,&8000 ;This is a comment</langsyntaxhighlight>
=={{header|zigZig}}==
<langsyntaxhighlight lang="zig">// This is a normal comment in Zig
/// This is a documentation comment in Zig (for the following line)</langsyntaxhighlight>
 
=={{header|zkl}}==
<langsyntaxhighlight lang="zkl">x=1; // comment ala C++
x=2; # ala scripts
/* ala C, these comments are parsed (also ala C) */
Line 3,462 ⟶ 3,751:
#<<<#
"here" comment, unparsed
#<<<#</langsyntaxhighlight>
 
=={{header|Zoea}}==
<syntaxhighlight lang="zoea">
<lang Zoea>
program comments # this program does nothing
 
Line 3,475 ⟶ 3,764:
comments
*/
</syntaxhighlight>
</lang>
 
=={{header|Zoea Visual}}==
Line 3,481 ⟶ 3,770:
 
=={{header|zonnon}}==
<langsyntaxhighlight lang="zonnon">
(* this is a comment *)
(*
Line 3,488 ⟶ 3,777:
(* with a nested comment *)
*)
</syntaxhighlight>
</lang>
=={{omit from|Computer/zero Assembly}}==
408

edits