A comment is a part of the program which doesn’t execute when running the program.
Its only purpose is to be read by someone who is editing the code.
- Single line, and
- Multiple lines
1. Single Line
// for single line comments. If you want to comment more than one line using this then you need to put this on each line.
2. Multiple Lines
It starts with
/* and ends with
*/. Between this the content that needs to be the comment.
3. Useful for
- To let others understand what you are doing – Comments let other programmers understand what you were doing in each step ( if you work in a group ).
- To remind yourself what you did.