各种编程语言的注释符
常见语言:
c
行注释:none
块注释:
扩展名:.c/.h
c++
行注释://这里是注释
块注释:
扩展名:.cpp/.h
c#
行注释://这里是注释
块注释:
xml注释:///这里是xml注释
扩展名:.cs
vb
行注释:'这里是注释
块注释:none
扩展名:.bas
java
行注释://这里是注释
块注释:
扩展名:.java
vb.net
行注释:'这里是注释
块注释:none
xml注释:///这里是xml注释
扩展名:.vb
perl
行注释:#这里是注释
块注释:none
扩展名:.pm
html
行注释:none
块注释:<!--这里是注释-->
扩展名:.htm/.html
SQL
行注释:--
块注释:
Comment comparison
There is a wide variety of syntax styles for declaring comments in source code.
BlockComment
in italics is used here to indicate block comment style.
InlineComment
in italics is used here to indicate inline comment style.
Language | In-line comment | Block comment |
---|---|---|
Ada , Eiffel , Euphoria , Occam , SPARK , ANSI SQL , ToolBook OpenScript , and VHDL |
|
|
ALGOL 60 |
|
|
ALGOL 68 |
|
|
AppleScript |
|
|
Assembly language (varies) |
one example (most assembly languages use line comments only) |
|
AutoHotkey |
|
|
AWK , Bash , Bourne shell , C shell , Maple , Python , R , Tcl , and Windows PowerShell |
|
|
BASIC (various dialects): |
(not all dialects)
|
|
C (K&R, ANSI/C89/C90), CHILL , PL/I , and REXX |
|
|
C (C99) , C++ , Go , and JavaScript |
|
|
C# |
(XML documentation comment) |
(XML documentation comment) |
Cobol |
(when * is in column 7) |
|
Curl |
|
|
Cobra |
|
(nestable) |
D |
( ddoc comments) |
( ddoc comments)
|
DCL |
|
|
ECMAScript ( JavaScript , ActionScript , etc.) |
|
|
Forth |
|
(single line only)
|
FORTRAN 66/77 |
(the letter 'C' in the first column makes the entire line a comment). |
|
Fortran 90 |
(all characters on the line, from the exclamation mark onwards, are comments) |
|
Haskell |
|
|
Java |
|
|
Lisp and Scheme |
|
|
Lua |
|
(variable number of = signs) |
Maple |
|
|
Mathematica |
|
|
Matlab |
|
Note: Both percent–bracket symbols must be the only non-whitespace characters on their respective lines. |
Object Pascal (Delphi) |
|
|
OCaml |
|
|
Pascal , Modula-2 , Modula-3 , Oberon , and ML : |
(OCaml comments are nestable) |
|
Perl and Ruby |
|
( POD documentation comment)
|
PHP |
|
( PHP Doc comments ) |
PILOT |
|
|
PL/SQL and TSQL |
|
|
REALbasic |
|
|
SAS |
|
|
Seed7 |
|
|
Simula |
|
|
Smalltalk |
|
|
Smarty |
|
|
Standard ML |
|
|
TeX , LaTeX , PostScript , Erlang , and S-Lang |
|
|
Texinfo |
|
|
TUTOR |
|
|
Visual Basic |
|
|
Visual Basic .NET |
|
|
Visual Prolog |
|
|
参考推荐:
Comparison of programming languages (syntax)
(wiki)
原文: 各种编程语言的注释符
版权所有: 本文系米扑博客原创、转载、摘录,或修订后发表,最后更新于 2012-09-28 16:54:44
侵权处理: 本个人博客,不盈利,若侵犯了您的作品权,请联系博主删除,莫恶意,索钱财,感谢!
转载注明: 各种编程语言的注释符 (米扑博客)