Comments: Difference between revisions

7,361 bytes added ,  17 days ago
m
Remove FutureBasic apostrophe single line comment as it's deprecated
(Comments in SuperTalk)
m (Remove FutureBasic apostrophe single line comment as it's deprecated)
 
(37 intermediate revisions by 22 users not shown)
Line 18:
 
=={{header|11l}}==
<syntaxhighlight lang="11l"pre>// Single line comment
\\ Also single line comment (continuation of the comment in previous line)
 
Line 32:
 
\‘ And
this ’</syntaxhighlightpre>
 
=={{header|360 Assembly}}==
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 309 ⟶ 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:
 
Line 327 ⟶ 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):
Line 385 ⟶ 403:
# and this is too
print "this is code" #comment after statement</syntaxhighlight>
 
==={{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}}===
<syntaxhighlight lang="is-basic">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</syntaxhighlight>
 
==={{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}}===
<syntaxhighlight lang="qbasic">!this is a comment
PRINT "this is code" !comment after statement</syntaxhighlight>
 
==={{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}}===
Line 506 ⟶ 559:
;(almost - you can still skip into it.) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</syntaxhighlight>
 
=={{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}}==
Line 529 ⟶ 586:
Line
Comment *#</syntaxhighlight>
 
=={{header|Bruijn}}==
Bruijn does not have multi-line comments.
<syntaxhighlight lang="bruijn"># This is a comment</syntaxhighlight>
 
=={{header|Brlcad}}==
Line 673 ⟶ 734:
<syntaxhighlight lang="lisp">(+ 1 (comment "foo") 3) ;; Throws an exception, because it tries to add nil to an integer
(+ 1 #_"foo" 3) ;; Returns 4</syntaxhighlight>
 
=={{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}}==
Line 924 ⟶ 1,001:
<syntaxhighlight lang="ecl"> /* this is a block comment - the terminator can be on the same line
or any succeeding line – everything in between is ignored */</syntaxhighlight>
 
=={{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}}==
Line 987 ⟶ 1,073:
(- y x))</syntaxhighlight>
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}}==
Line 1,044 ⟶ 1,144:
# and last until the end of the line
</syntaxhighlight>
 
=={{header|Fennel}}==
<syntaxhighlight lang="fennel">; This is a single-line comment</syntaxhighlight>
 
=={{header|Fermat}}==
Line 1,165 ⟶ 1,268:
<syntaxhighlight lang="futurebasic">
// Single line comment
' Single line comment
rem Single line comment
/* Single line comment */
Line 1,331 ⟶ 1,433:
 
[Comments can [be nested].]</syntaxhighlight>
 
=={{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}}==
Line 1,554 ⟶ 1,670:
=={{header|Lambdatalk}}==
<syntaxhighlight 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
°°°
Line 1,565 ⟶ 1,687:
=={{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}}==
Line 1,577 ⟶ 1,717:
</syntaxhighlight>
 
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}}==
Line 1,704 ⟶ 1,844:
 
=={{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 //
 
Rem (form start of code line)
 
(:\ and \\ or \) in a name can exist only for Dir statement:
 
dir c:\thatfolder
 
is the same as
 
dir "c:\thatfolder"
 
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.
 
<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
Line 1,799 ⟶ 1,957:
/* A comment block can also be defined using climbstar and starclimb symbols.
This allows comments to be stretched across several lines */</syntaxhighlight>
 
 
=={{header|MEL}}==
<syntaxhighlight lang="mel">// This is a single line comment</syntaxhighlight>
 
=={{header|Metafont}}==
Line 1,813 ⟶ 1,975:
<syntaxhighlight lang="min">; this is a comment
1 1 + ; add one and one together</syntaxhighlight>
 
=={{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}}==
Line 1,825 ⟶ 1,993:
<syntaxhighlight lang="mips">;this is a comment
li $t0,0x1234 ;this is also a comment</syntaxhighlight>
 
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}}==
Line 2,113 ⟶ 2,285:
{{libheader|Phix/basics}}
Single line comment:
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">-- Thisthis is a comment.
// this is also a comment. </span>
<!--</syntaxhighlight>-->
 
Line 2,134 ⟶ 2,307:
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}}==
Line 2,385 ⟶ 2,565:
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="quackery">
( The word "(" is a compiler directive (a builder,
Line 2,428 ⟶ 2,607:
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">; this is a to-end-of-line coment
; this is a to-end-of-line coment
 
#| balanced comment, #| can be nested |# |#
Line 2,436 ⟶ 2,614:
 
#; ; the following expression is commented because of the #; in the beginning
(ignored)</syntaxhighlight>
 
</syntaxhighlight>
 
=={{header|Raku}}==
Line 2,499 ⟶ 2,675:
 
=={{header|Raven}}==
 
<syntaxhighlight lang="raven"> # this is a comment</syntaxhighlight>
 
=={{header|REBOL}}==
<syntaxhighlight lang="rebol">; This is a line comment.
 
<syntaxhighlight lang="rebol">
; This is a line comment.
 
{ Multi-line strings can
Line 2,690 ⟶ 2,863:
 
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}}==
Line 2,761 ⟶ 2,949:
=={{header|Sather}}==
<syntaxhighlight lang="sather">-- a single line comment</syntaxhighlight>
 
=={{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}}==
Line 3,420 ⟶ 3,646:
</syntaxhighlight>
 
=={{header|V (Vlang)}}==
<pre>
// This is a single line comment.
Line 3,438 ⟶ 3,664:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">// This is a line comment.
/* This is a single line block comment.*/
/* This is
Line 3,444 ⟶ 3,670:
block comment.*/
/* This is/* a nested */block comment.*/</syntaxhighlight>
 
 
=={{header|X10}}==
Line 3,512 ⟶ 3,737:
Note: syntax depends on the assembler software but use of a semicolon is fairly standard. VASM and WinAPE use the semicolon.
<syntaxhighlight lang="z80"> ld hl,&8000 ;This is a comment</syntaxhighlight>
=={{header|zigZig}}==
<syntaxhighlight lang="zig">// This is a normal comment in Zig
/// This is a documentation comment in Zig (for the following line)</syntaxhighlight>
408

edits