Comments: Difference between revisions

4,313 bytes added ,  18 days ago
m
Remove FutureBasic apostrophe single line comment as it's deprecated
(S-BASIC example)
m (Remove FutureBasic apostrophe single line comment as it's deprecated)
 
(25 intermediate revisions by 15 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 996 ⟶ 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,053 ⟶ 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,174 ⟶ 1,268:
<syntaxhighlight lang="futurebasic">
// Single line comment
' Single line comment
rem Single line comment
/* Single line comment */
Line 1,340 ⟶ 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,610 ⟶ 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,868 ⟶ 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 2,172 ⟶ 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,193 ⟶ 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,444 ⟶ 2,565:
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="quackery">
( The word "(" is a compiler directive (a builder,
Line 2,487 ⟶ 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,495 ⟶ 2,614:
 
#; ; the following expression is commented because of the #; in the beginning
(ignored)</syntaxhighlight>
 
</syntaxhighlight>
 
=={{header|Raku}}==
Line 2,558 ⟶ 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,755 ⟶ 2,869:
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,828 ⟶ 2,952:
=={{header|S-BASIC}}==
<syntaxhighlight lang="BASIC">
rem S-BASIC supportsof course allows traditional BASIC-style comments
 
comment
Line 2,862 ⟶ 2,986:
print "Must specify a loan amount!"
end
<\/syntaxhighlight>
 
=={{header|Scala}}==
Line 3,540 ⟶ 3,664:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">// This is a line comment.
/* This is a single line block comment.*/
/* This is
Line 3,546 ⟶ 3,670:
block comment.*/
/* This is/* a nested */block comment.*/</syntaxhighlight>
 
 
=={{header|X10}}==
Line 3,614 ⟶ 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