各种编程语言的注释符
2015-08-29 19:23
295 查看
Comment comparison
There is a wide variety of syntax styles for declaring comments in source code.
参考推荐:
Comparison of programming languages (syntax) (wiki)
There is a wide variety of syntax styles for declaring comments in source code.
BlockCommentin italics is used here to indicate block comment style.
InlineCommentin 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 | -- InlineComment | |
ALGOL 60 | comment BlockComment; | |
ALGOL 68 | ¢ BlockComment ¢ comment BlockComment comment co BlockComment co # BlockComment # £ BlockComment £ | |
AppleScript | -- InlineComment | (* BlockComment *) |
Assembly language (varies) | ; InlineCommentone example (most assembly languages use line comments only) | |
AutoHotkey | ; InlineComment | /* BlockComment */ |
AWK, Bash, Bourne shell, C shell, Maple, Python, R, Tcl, and Windows PowerShell | # InlineComment | <# BlockComment #> |
BASIC (various dialects): | 'InlineComment(not all dialects) REM InlineComment | |
C (K&R, ANSI/C89/C90), CHILL, PL/I, and REXX | /* BlockComment */ | |
C (C99), C++, Go, and JavaScript | // InlineComment | /* BlockComment */ |
C# | // InlineComment /// InlineComment(XML documentation comment) | /* BlockComment */ /** BlockComment */(XML documentation comment) |
Cobol | InlineComment(when * is in column 7) | |
Curl | || InlineComment | |# BlockComment #| |foo# BlockComment #| |
Cobra | # InlineComment | /# BlockComment #/(nestable) |
D | // InlineComment /// Documentation InlineComment(ddoc comments) | /* BlockComment */ /** Documentation BlockComment */(ddoc comments) /+ BlockComment +/(nestable) /++ Documentation BlockComment +/(nestable, ddoc comments) |
DCL | $! InlineComment | |
ECMAScript (JavaScript, ActionScript, etc.) | // InlineComment | /* BlockComment */ |
Forth | \ InlineComment | ( BlockComment )(single line only) ( before -- after )stack comment convention |
FORTRAN 66/77 | C InlineComment(the letter 'C' in the first column makes the entire line a comment). | |
Fortran 90 | ! InlineComment(all characters on the line, from the exclamation mark onwards, are comments) | |
Haskell | -- InlineComment | {- BlockComment -} |
Java | // InlineComment | /* BlockComment */ /** BlockComment */(Javadoc documentation comment) |
Lisp and Scheme | ; InlineComment | #| BlockComment |# |
Lua | -- InlineComment | --[==[ BlockComment]==](variable number of = signs) |
Maple | # InlineComment | (* BlockComment *) |
Mathematica | % (* BlockComment *) | |
Matlab | % InlineComment | %{ BlockComment (nestable) %} Note: Both percent–bracket symbols must be the only non-whitespace characters on their respective lines. |
Object Pascal (Delphi) | // InlineComment | (* BlockComment *) { BlockComment } |
OCaml | (* BlockComment (* nestable *) *) | |
Pascal, Modula-2, Modula-3, Oberon, and ML: | (* BlockComment *)(OCaml comments are nestable) | |
Perl and Ruby | # InlineComment | =begin BlockComment =cut(POD documentation comment) __END__ Comments after end of code |
PHP | # InlineComment // InlineComment | /* BlockComment */ /** Documentation BlockComment */(PHP Doc comments) |
PILOT | R:InlineComment | |
PL/SQL and TSQL | -- InlineComment | /* BlockComment */ |
REALbasic | ' InlineComment // InlineComment rem InlineComment | |
SAS | * BlockComment; /* BlockComment */ | |
Seed7 | # InlineComment | (* BlockComment *) |
Simula | comment BlockComment; ! BlockComment; | |
Smalltalk | "BlockComment" | |
Smarty | {* BlockComment *} | |
Standard ML | (* BlockComment *) | |
TeX, LaTeX, PostScript, Erlang, and S-Lang | % InlineComment | |
Texinfo | @c InlineComment @comment InlineComment | |
TUTOR | * InlineComment command $$ InlineComment | |
Visual Basic | ' InlineComment Rem InlineComment | |
Visual Basic .NET | ' InlineComment ''' InlineComment(XML documentation comment) Rem InlineComment | |
Visual Prolog | % InlineComment | /* BlockComment */ |
Comparison of programming languages (syntax) (wiki)
相关文章推荐
- 【C/C++】指针基本问题
- 随想录(高质量代码开发)
- PHP namespace的定义
- 【C/C++】运算符问题
- 作业《IOS_C语言》结构体、结构体数组
- Java基础知识强化05:不借助第三个变量实现两个变量互换
- 基于Java自带同步机制实现生产者-消费者模式
- Delphi 指针大全(光看不练是学不会的)
- Java栈与堆
- delphi编程里的bool跟boolean类型有什么区别
- Python中的列表生成式和多层表达式
- Java JVM(五):JDK8 新特性
- Lua学习笔记--模块与包
- 读取matlab某个路径下的“.mat”文件,改变文件中的内容,并以原名字,变量保存
- Lua学习笔记--Lua调用C初探
- this(C#)
- this(C#)
- LeetCode-Add Digits-解题报告
- Java Web应用目录结构
- Lua5.2改动