各种编程语言的注释符

常见语言:

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.BlockCommentin italics is used here to indicate block comment style.InlineCommentin italics is used here to indicate inline comment style.

LanguageIn-line commentBlock comment
Ada,Eiffel,Euphoria,Occam,SPARK, ANSISQL,ToolBook OpenScript, andVHDL --InlineComment
ALGOL 60commentBlockComment;
ALGOL 68 ¢BlockComment¢

commentBlockCommentcomment
coBlockCommentco
#BlockComment#
£BlockComment£

AppleScript--InlineComment(*BlockComment*)
Assembly language(varies) ;InlineComment one example (most assembly languages use line comments only)
AutoHotkey;InlineComment/*BlockComment*/
AWK,Bash,Bourne shell,C shell,Maple,Python,R,Tcl, andWindows PowerShell #InlineComment<#BlockComment#>
BASIC(various dialects): 'InlineComment(not all dialects)

REMInlineComment

C(K&R, ANSI/C89/C90),CHILL,PL/I, andREXX /*BlockComment*/
C (C99),C++,Go, andJavaScript //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
/// DocumentationInlineComment(ddoccomments)
/*BlockComment*/
/** DocumentationBlockComment*/(ddoccomments)

/+BlockComment+/(nestable)
/++ DocumentationBlockComment+/(nestable,ddoccomments)

DCL$!InlineComment
ECMAScript(JavaScript,ActionScript, etc.)//InlineComment/*BlockComment*/
Forth\InlineComment (BlockComment)(single line only)

(before--after)stack comment convention

FORTRAN66/77 CInlineComment(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*/(Javadocdocumentation comment)

LispandScheme ;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, andML: (*BlockComment*)(OCaml comments are nestable)
PerlandRuby #InlineComment =begin
BlockComment
=cut
(PODdocumentation comment)

__END__
Comments after end of code

PHP #InlineComment
//InlineComment
/*BlockComment*/
/** DocumentationBlockComment*/(PHP Doc comments)
PILOTR:InlineComment
PL/SQLandTSQL --InlineComment/*BlockComment*/
REALbasic 'InlineComment
//InlineComment
remInlineComment
SAS *BlockComment;
/*BlockComment*/
Seed7#InlineComment(*BlockComment*)
Simula commentBlockComment;
!BlockComment;
Smalltalk"BlockComment"
Smarty{*BlockComment*}
Standard ML(*BlockComment*)
TeX,LaTeX,PostScript,Erlang, andS-Lang %InlineComment
Texinfo @cInlineComment

@commentInlineComment

TUTOR *InlineComment
command$$InlineComment
Visual Basic 'InlineComment
RemInlineComment
Visual Basic .NET 'InlineComment

'''InlineComment(XML documentation comment)
RemInlineComment

Visual Prolog%InlineComment/*BlockComment*/



参考推荐:

Comparison of programming languages (syntax) (wiki)


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值