Comments are segments of the code which don’t have any effect on the result of the program, they’re just meant to explain or complete the information so it can be easily understood by the user and other people that sees the code. There are 2 different ways of commenting a code, first, by using // to start and finish a comment, this type of comment just work on a single line and you want to continue the comment you’ll have to repeat the // symbols. Elsewhere, you might write a multi-line code by starting with a /* and closing the comment with */, this is useful to write a large comment to explain a function or warnings regarding the code but you’ll have to be aware that if you write */ what follows continues to be a comment until that symbol is presented. Comments are recognized by faded or colored text.

Here’s a segment of a code with comments:

 

Remember to always close the multiple line comment or the editor will consider some instructions as comments:

In other text editors, comments might be different, for instance in Eclipse comments turn to different color, here’s part of a code with a comment which aids the user to understand what does a segment does:

Thanks for watching, and hope this aids you.

CC BY 4.0 Comments on codes #Mastery7 by Carlos Gallegos is licensed under a Creative Commons Attribution 4.0 International License.