Content deleted Content added
Stevebroshar (talk | contribs) →Examples: Group scripting languages |
Stevebroshar (talk | contribs) →Examples: Merge swift into curly brace section |
||
Line 346:
====Curly brace languages====
Many of the [[curly brace language]]s such as C, C++ and their many derivatives delimit a line comment with {{code|//}} and a block comment with {{code|/*}} and {{code|*/}}. Originally, C lacked the line comment, but it was added in [[C99]]. Notable languages include: C, C++, [[C# (programming language)|C#]], [[Java (programming language)|Java]], [[Javascript]] and [[
<syntaxhighlight lang="c">
Line 357:
// TODO implement
}
</syntaxhighlight>▼
Some languages, including Swift, allow blocks to be nested while other do not, including C and C++. An example of nested blocks in Swift:
<syntaxhighlight lang="swift">▼
/* This is the start of the outer comment.▼
/* This is the nested comment. */▼
This is the end of the outer comment. */▼
</syntaxhighlight>
Line 370 ⟶ 378:
</syntaxhighlight>
=====
Although Python does not provide for block comments<ref name=triple>{{cite web |url=https://www.tutorialdocs.com/tutorial/python3/python3-basic-syntax.html |title=Python 3 Basic Syntax |access-date=25 February 2019 |quote=Triple quotes are treated as regular strings with the exception that they can span multiple lines. By regular strings I mean that if they are not assigned to a variable they will be immediately garbage collected as soon as that code executes. hence are not ignored by the interpreter in the same way that #a comment is. |archive-date=19 August 2021 |archive-url=https://web.archive.org/web/20210819164828/https://www.tutorialdocs.com/tutorial/python3/python3-basic-syntax.html |url-status=dead }}</ref> a bare [[string literal]] represented by a triple-quoted string is often used for this purpose.<ref>[https://twitter.com/gvanrossum/status/112670605505077248 "Python tip: You can use multi-line strings as multi-line comments"], 11 September 2011, Guido van Rossum</ref><ref name=triple/> In the examples below, the triple double-quoted strings act like comments, but are also treated as [[docstring]]s:
Line 812 ⟶ 820:
MySQL also supports comments from the hash (#) character to the end of the line.
▲<syntaxhighlight lang="swift">
▲</syntaxhighlight>
▲/* This is the start of the outer comment.
▲ /* This is the nested comment. */
▲This is the end of the outer comment. */
====XML and HTML====
|