各种语言的注释总结--from wiki
Comments can be classified by:
- style (inline/block)
- parse rules (ignored/interpolated/stored in memory)
- recursivity (nestable/non-nestable)
- uses (docstrings/throwaway comments/other)
Inline comments[edit]
Inline comments are generally those that use a newline character to indicate the end of a comment, and an arbitrary delimiter or sequence of tokensto indicate the beginning of a comment.
Examples:
| Symbol | Languages |
|---|---|
C |
Fortran 77 and earlier; the 'C' must be in column 1 of a line to indicate a comment. |
REM, ::, : |
BASIC, COMMAND.COM, cmd.exe, batch files |
NB. |
J; from the (historically) common abbreviation Nota bene, the Latin for "note well". |
⍝ |
APL; the mnemonic is the glyph (jot overstruck with shoe-down) resembles a desk lamp, and hence "illuminates" the foregoing. |
# |
Bourne shell and other UNIX shells, Cobra, Perl, Python, Ruby, Seed7, Windows PowerShell, PHP, R, Maple |
% |
TeX, Prolog, MATLAB,[9] Erlang, S-Lang, Visual Prolog |
// |
ActionScript, C (C99), C++, C#, D, Go, Java, JavaScript, Object Pascal (Delphi), Objective-C, PHP, Scala, SASS |
' |
Visual Basic, VBScript, RealBasic |
! |
Fortran, Basic Plus, Inform |
; |
AutoHotkey, AutoIt, Lisp, Common Lisp, Clojure, Rebol, Scheme, many assemblers |
-- |
Euphoria, Haskell, SQL, Ada, AppleScript, Eiffel, Lua, VHDL, SGML |
* |
COBOL (if fixed-form and * in column 7), PAW, many assemblers, Fortran (if fixed-form and * in column 1) |
|| |
Curl |
" |
Vimscript |
\ |
Forth |
Block comments[edit]
Block comments are generally those that use a delimiter to indicate the beginning of a comment, and another delimiter to indicate the end of a comment. In this context, whitespace and newline characters are not counted as delimiters.
Examples:
| Symbol | Languages |
|---|---|
¢ ~ ¢, # ~ #, co ~ co, comment ~comment |
ALGOL 68 |
/* */ |
ActionScript, AutoHotkey, C, C++, C#, D, Go, Java, JavaScript, Objective-C, PHP, PL/I, Scala (can be nested), SASS, SQL, Visual Prolog, CSS |
#cs #ce |
AutoIt |
/+ +/ |
D (can be nested) |
/# #/ |
Cobra (can be nested) |
<# #> |
Powershell |
=begin =cut |
Perl |
=begin =end |
Ruby |
#<tag></code> <code>#</tag> |
S-Lang |
{- -} |
Haskell (can be nested) |
(* *) |
Object Pascal (Delphi), ML, Mathematica, Pascal, Seed7, Applescript, OCaml (can be nested), Standard ML (can be nested), Maple, Newspeak |
{ } |
Object Pascal (Delphi), Pascal |
|# #| |
Curl |
%{ %} |
MATLAB[9] (the symbols must be in a separate line) |
#| |# |
Lisp, Scheme, Racket (can be nested in all three). |
--[[ ]] |
Lua |
" " |
Smalltalk |
(comment ...) |
Clojure |
各种语言的注释总结--from wiki的更多相关文章
- C语言程序注释风格
良好编程习惯的养成对于一个程序员的发展非常重要,而注释对于一份程序来讲又是一个必不可少的组成部分,今天来研究一下C语言程序的注释风格. 注释是源码程序中非常重要的一部分,一般情况下,源程序有效注释量必 ...
- django模板语言的注释
就像HTML或者Python,Django模板语言同样提供代码注释. 注释使用 {# #} : ? 1 {# This is a comment #} 注释的内容不会在模板渲染时输出. 用这种语法的注 ...
- C语言-删除注释
C语言中的注释,不嵌套,一律使用/* */的形式.不过双引号中的/* */则不能算是注释. 以下是正确的代码 /* * ===================================== ...
- C语言进阶——注释符号12
注释可能大认为非常简单,但是注释其实在C语言中很关键,来看下面一段对话. ---学生: 老师,我觉得注释没有必要深究,因为很简单,对程序功能也没有影响. ---老师: 注释是C语言最重要的工具,我们先 ...
- django 模板语言的注释操作
Django在HTML里面书写的模板语言不能使用这种方法注释,这样注释实际依然有效 <!--{% if text %}--> 第一种使用模板标签{% comment %}注释,这是块注释 ...
- C语言讲义——注释
注释 什么是注释? --注释写在代码中的文字,不参与代码编译,不影响运行结果. 为什么要注释?--让代码可读性更强. C语言有两种注释: 单行注释 // 多行注释 /* */ 多行注释可以只有一行, ...
- 【学习笔记】【C语言】注释
1. 什么是注释 1) 注释是在所有计算机语言中都非常重要的一个概念,从字面上看,就是注解.解释的意思 2) 注释可以用来解释某一段程序或者某一行代码是什么意思,方便程序员之间的交流.假如我写完一行代 ...
- jsp基础语言-jsp注释
JSP注释可分为客户端注释和服务器端注释. 客户端注释:用户可通过浏览器中的源代码查看,且这种注释可以加入JSP表达式. 语法:<!-- 客户端注释[<%=表达式%>] --> ...
- python语言快捷注释
1.注释单行 (1)方法1:直接在单行代码前边加 # (2)方法2:选中需要注释的代码,Ctrl+/ 即可注释 2.注释多行代码 选中想要注释的N行代码,直接Ctrl+/ 即可注释 3.取消注释多行代 ...
随机推荐
- 容器计划任务大坑:在alpine容器里,想用非root帐号执行crontab任务
我只能说抱歉,我前前后后测试了七天, 将自己预想的配置错误,一个一个去验证. 非root帐号在alpine容器里执行crontab任务,还是失败, 输出依旧是一片空白~ stackoverflow里, ...
- drools7 (四、FactHandle 介绍)
先看代码 Base.java package cn.xiaojf.drools7.base; import org.apache.commons.lang3.StringUtils; import o ...
- day9--paramiko模块
志不坚者智不达 paramiko:在Linux链接其他机器,每台Linux机器都有一个SSHClient:Python自己也写了一个SSHClient,那么Python写paramiko创建SSHCl ...
- javascript和jquery如何判断元素是否存在最佳。
在传统的Javascript里,当我们对某个页面元素进行某种操作前,最好先判断这个元素是否存在.原因是对一个不存在的元素进行操作是不允许的.例如: document.getElementById(&q ...
- 在windows下的CLI模式下如何运行php文件
https://blog.csdn.net/evkj2013/article/details/52313728 https://jingyan.baidu.com/article/da1091fb09 ...
- 实现linux和windows文件传输
其实这个题目有点大,这里介绍的只是linux和windows文件传输中的一种,但是这种方法却非常实用,那就是:ZModem协议具体是linux命令是:rz和sz但是其实它们是两个非常方便的工具. ...
- printf的定义
1. printf的宏定义 #define XXX_ERROR 0#define XXX_WARNING 1#define XXX_INFO 2#define XXX_DEBUG 3#define X ...
- [CodeForces - 848B] Rooter's Song 思维 找规律
大致题意: 有一个W*H的长方形,有n个人,分别站在X轴或Y轴,并沿直线向对面走,第i个人在ti的时刻出发,如果第i个人与第j个人相撞了 那么则交换两个人的运动方向,直到走到长方形边界停止,问最后每个 ...
- openstack policy 鉴权过程分析
转:http://blog.chinaunix.net/uid-20940095-id-4144300.html 1. openstack 鉴权简单介绍 众所周知,openstack通过k ...
- [ 转载 ] Java基础11--Java总结篇系列:Java泛型
一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下面这段简短的代码: 1 public class GenericTest { 2 3 public static void main(Stri ...