[雜記]各種編程語言的註釋

Language

In-line comment

Block comment

C (C99), C++, Go, and JavaScript

// InlineComment

/* BlockComment */

CSS

/* 註釋內容 */

/* 註釋內容 */

HTML

<!--註釋內容- ->

<!--註釋內容- ->

Java

// InlineComment


/* BlockComment */

/** BlockComment */ (Javadoc documentation comment)

Matlab

% InlineComment

%{
BlockComment (nestable)
%}
Note: Both percent–bracket symbols must be the only non-whitespace characters on their respective lines.

PHP

# InlineComment
// InlineComment

/* BlockComment */
/** Documentation BlockComment */ (PHP Doc comments)

PL/SQL and TSQL

-- InlineComment


/* BlockComment */

 

Python

# InlineComment

''' BlockComment '''
""" BlockComment """

(Documentation string when first line of module, class, method, or function)

 

參考:

https://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28syntax%29#Comments

 

發佈了73 篇原創文章 · 獲贊 17 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章