Commenting out code

You can comment out one or more lines of code. The leading characters // are added to the beginning of each line.

Tip: The characters /* */ on lines that already are already commented out are not affected when you comment and uncomment code as described above.

To comment out code:

  1. In the C/C++ editor, select the line(s) of code that you want to comment out. If no lines are selected comments will be added (or removed) at the current cursor positition.
  2. Right-click and do one of the following:
Tip: Instead of using the context menu (right click) you can quickly comment out by pressing CTRL+/ or remove comments by pressing CTRL+\.

Related concepts
Code entry

Related tasks
Customizing the C/C++ editor
Working with Content Assist

Related reference
C/C++ editor preferences

IBM Copyright Statement