You can pass in the code: //comment, /*comment*/, , #comment, '''comment''', --comment, 'comment, %comment and so on to add comments. The following article will introduce you to the methods of code annotation by category. I hope it will be helpful to you.

Common code comment methods:
HTML comments
<!--这里是注释-->
CSS Comments
/*这里是注释*/
JavaScript Comments
Single Line Comments:
//这里是注释
Block (Multiple lines) Comments:
/*这里是注释*/
XML Comments
<!--这里是注释-->
C/C /C# Code Comments
Single-line comments:
//这里是注释
Block (multi-line) comments:
/*这里是注释*/
Java comments
Single-line comments:
//这里是注释
Block (multi-line) comments:
/*这里是注释*/
Python comments
Single-line comments:
#这里是注释
Block ( Multiple lines) Comment:
'''这里是注释'''
VB comment
'这是一个单行注释
Note: It is a single quote followed by the comment
perl comments
Single line comments:
# 这是一个单行注释
Block (multiline) comments:
=pod 这里是注释 =cut
Matlab comments
Single-line comments:
%这里是注释
Block (multi-line) comments:
%%这里是注释%%
%{这里是注释%}R language comments
Single-line comments:
#这里是注释
Block (multi-line) comments:
if(false){这里是注释}Why add comments?
Comments are "hints" or "explanations" of the code, not documents; comments are mainly used to explain code complexity; comments should be accurate and easy to understand (unambiguous) sex), concise; the amount of effective comments in the program must be more than 20%. It is definitely a good habit to add comments to the code. It is best to comment while writing the code
The purpose of comments: to facilitate the maintenance of the code, explain the functions and methods of the code, facilitate readers to read, and prevent unnecessary duplication of information .
Note: If the code is clear and self-explanatory, there is no need to add comments. Overly detailed comments can easily make people bored. Remember not to think that others cannot understand it without adding comments.
The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !
The above is the detailed content of How to add code comments?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),





