前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >各种编程语言的注释符

各种编程语言的注释符

作者头像
阳光岛主
发布2019-02-19 15:31:35
2.3K0
发布2019-02-19 15:31:35
举报
文章被收录于专栏:米扑专栏米扑专栏

常见语言:

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

-- InlineComment

ALGOL 60

comment BlockComment;

ALGOL 68

¢ BlockComment ¢comment BlockComment commentco BlockComment co# 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, 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

=beginBlockComment=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// InlineCommentrem 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

* InlineCommentcommand $$ InlineComment

Visual Basic

' InlineCommentRem InlineComment

Visual Basic .NET

' InlineComment''' InlineComment (XML documentation comment)Rem InlineComment

Visual Prolog

% InlineComment

/* BlockComment */

参考推荐:

Comparison of programming languages (syntax)  (wiki)

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2012年09月28日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档