How to comment multiple lines in the code


some times i test more than one piece of code how to comment ( add # ) or uncomment ( remove the # ) multiple lines at once


I haven’t found any ways to multi-line comment in CC (Python).
Apparently, consecutive single-line comments are favoured in Python. This is not a problem because most editors, including CodeCombat’s, have shortcuts to do this.

The default editor configuration in CC uses Ace key bindings (can be changed in the options).
To comment multiple lines, just select the text and press Ctrl-/ (Cmd-/ on Mac)

Find more Ace keyboard shortcuts here.
(It turns out you can even Find text using Ctrl-F)


An addition for the interested reader:

For Javascript the multi-line comment looks like this:

// Single line


 * Also a 
 * Multiline-
 * comment, but
 * seen more often.

The * (except the very first and last ones) are completely irrelevant, but provide a good look and a baseline for the reader. When presenting code I usually prefer the second variant.


@zuf , Thanks that helps


Just what I was looking for! Very useful when you’re trying out bits of code :slight_smile: