Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to quickly Comment and uncomment a code?

Sometimes I have the need to try: A code example or a variant of it.
This is necessary to test a new functionality or to test its implementation or performance. The code can be very long.
So I need some way to quickly comment on the code with

/*  
 * mi código  
 * …  
 * /

O con:

//  
// mi código  
// …  
//

When the code is very long, it is cumbersome to do: Select all the code you do not want to run and discuss, Write or insert the code you want to try, Do tests or whatever...
Now...
Select and comment on the new block of code.
Search and select the previous code, and Uncomment.
Do tests or whatever...
And so I need to do it many times since I'm recycling, as I have been thirty years since I program almost nothing.

Is There any way or trick to do it quickly?

like image 662
Manuel Rosendo Castro Iglesias Avatar asked Apr 02 '19 19:04

Manuel Rosendo Castro Iglesias


People also ask

How do you get uncomment codes quickly?

If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code.

How do you shortcut and uncomment a comment?

Comment and uncomment lines of code Press Ctrl+/ .

How do you comment multiple lines at once or code?

ctrl + shift + A worked for me for adding multi-line comment.


2 Answers

If you're in vs code just enter ctrl + /. For VS studio 2017 ctrl + k + u.

like image 133
Evan Gertis Avatar answered Nov 01 '22 07:11

Evan Gertis


If you are using visual studio as your IDE you can use the following: Ctrl+K+C to commment and Ctrl+K+U to uncomment.

If using pycharm or VS Code: Use Cntrl+/ to comment and uncomment.

like image 5
Jayant Rajwani Avatar answered Nov 01 '22 07:11

Jayant Rajwani