Comments
A comment is text in your program that is not actually part of the program itself.
It is often useful to add comments to explain what different parts of your program are doing. This can be useful to remind you how certain sections work, and can be helpful explanation to any teammates or coworkers who may not have written the code themselves.
Later, we will learn how to write organized comments called documentation that explain both the structure and purpose of different parts of code.
One-line comments
A one-line comment begins with a //. For example:
//This is a one-line commentHere, all the text on the line beginning with // is ignored by the compiler.
Multi-line comments
A multi-line comment begins with a /* and ends with a */. For example:
/*This comment spans
multiple lines */Here, all text after the /* and before the matching */ is ignored by the compiler, even though this might span a number of lines.