LoginSignup
2

More than 3 years have passed since last update.

各言語のコメントアウトを一覧にまとめる

Last updated at Posted at 2019-09-08

はじめに

コーディング中は良いですが、しばらく触れないと忘れるため、まとめます。

コメントアウト一覧

言語 コメントアウト 補足
HTML <!-- comment -->
CSS /* comment */
Javascript // comment 1行コメント
/* comment */
Python # comment 1行コメント
''' comment '''
""" comment """
Java // comment 1行コメント
/* comment */
PHP // comment 1行コメント
# comment 1行コメント
/* comment */
SQL -- comment 1行コメント (※1)
# comment 1行コメント (※2)
/* comment */
Unix Shell # comment 1行コメント
vim " comment 1行コメント
MS-DOS REM comment 1行コメント
:: comment 1行コメント
PowerShell # comment 1行コメント
<# comment #>
VBA ' comment 1行コメント
JCL //" comment 1行コメント
Markdown [](comment) 1行コメント
<!-- comment --> (※3)

(※1) --の後ろに半角スペース要注意
(※2) MySQLが対応
(※3) HTMLと同じ記法が扱いやすい
(1行コメント内でバックスラッシュを区切っても複数行コメントは可能)

参考

docs.python.org : 字句解析 - コメント
Codecampus : Pythonでのコメントアウトの方法とは?
JavaScriptのコメントはこう書くべし! 活用法まで徹底解説
【Java】コメントの種類と書き方
IBM support : DB2 SQLステートメント
IBM support : JCLステートメント
MySQLのコメント構文
kin29.info : MySQLとPostgreSQLのコメントの書き方のちがい
あおきのTechメモ : バッチファイルの「::」コメント
バヤシタ : PowerShellコメントアウトの書き方
Markdown記法でコメントアウトする

おわりに

シェルスクリプトでは、このような技で複数行コメントアウトできるそうです。勉強になります。
bashで複数行コメントアウトする方法

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2