各种语言的注释总结--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.取消注释多行代 ...
随机推荐
- **PHP错误Cannot use object of type stdClass as array in错误的
错误:将PHP对象类型当做了PHP数组 解决方法:用对象操作符-> 今天在PHP输出一个二维数组的时候,出现了“Fatal error: Cannot use object of type s ...
- 二进制方式部署Kubernetes 1.6.0集群(开启TLS)
本节内容: Kubernetes简介 环境信息 创建TLS加密通信的证书和密钥 下载和配置 kubectl(kubecontrol) 命令行工具 创建 kubeconfig 文件 创建高可用 etcd ...
- Drawable子类之——StateListDrawable (选择器)
Drawable子类之——StateListDrawable (选择器) https://www.jianshu.com/p/7257ce82c762 本文出自 “阿敏其人” 简书博客,转载或引用请注 ...
- day2编写购物商城
作业:购物商城 商品展示,价格 买,加入购物车 付款,钱不够 流程图如下: 代码共有4个文件,如下: 用户文件: alex geng zhang lou zeng 商品文件: 小米3 比亚迪宋 格力变 ...
- 实现nlp文本生成中的beam search解码器
自然语言处理任务,比如caption generation(图片描述文本生成).机器翻译中,都需要进行词或者字符序列的生成.常见于seq2seq模型或者RNNLM模型中. 这篇博文主要介绍文本生成解码 ...
- C#使用Pechkin与CPechkin生成PDF
http://blog.sina.com.cn/s/blog_5a52cec70102wpcf.html 1. Pechkin 从NuGet程序管理器中获得Pechkin,代码示例如下: ...
- Socket 编程之 TCP 实现
前几天介绍了计算机网络的一些概念,并介绍了几个协议.下面就说说 Java 中的 Socket 编程,服务器和客户端是如何通信的呢? 首先要介绍一下 Socket ,我们知道在 TCP/IP 协议簇中, ...
- python创建有序字典OrderedDict()
python 有序字典OrderedDict # -*- coding:utf-8 -*- """ python有序字典 需导入模块collections "& ...
- webstorm2018最新激活码license server
2018.7.5最新激活码: license server:https://s.tuzhihao.com:666/ 以后持续更新....
- javascript面向对象系列第五篇
<style> .test{height: 50px;width: 50px;background-color: pink;position:absolute;} #test2{left: ...