It is very useful for both users and programmers. Users can easily understand the code.
1: It is used for comfort of the user ,with the help of comment users can easily interpret the code.
2: Sometimes we do not want some code to be executed ,in this case instead of deleting that code we can apply a comment on that code .
For example: we wrote some code for one time execution after execution we do not want to run the code so instead of deleting that code, it will be good to use comments .
We can use two types of comments.
- Single-line Comment
- Multi-line Comment
In a single line Comment we use (//) Double forward slashes.
Programmers can write it before or after the statement as per their requirement.
Following are the examples of single-line comment.
- // It is an example of single line comment syntax
2: Comments used after the statement.
It is used to add single or multi line comments. So, it is more convenient.
We can use multi line comments in our statement. Lots of programmers prefer multi line comments because it is easy to use.
To write this comment forward slash and asterisk(*)sign is used.
To start the comment first add forward slash(/) then asterisk(*)sign and to end the comment add asterisk(*) sign then forward slash(/).
- /* multi line comment for just one line */
So now you can learn more. HTML Registration Form – Easy Step by Step