You can easily add comments using either the C or C++ style, even to large sections of code. You can add two forward slash
characters (
//) at the beginning of lines to comment out large sections, even when they have other comment characters, such as
/* */.
When you remove comments from lines, the editor removes the leading // characters from all lines that have them, so be careful not to accidentally uncomment sections. Also, the editor can comment
or remove only comments from selected lines
— if you highlight a partial line, the editor comments out the entire line, not just the highlighted section.
To comment or remove comments from a block of code:
-
In the C/C++ editor, highlight a section of code to comment or remove comments. For a single line, position your cursor anywhere
on that line.
-
Right-click and select Comment or Uncomment.