Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to comment out blocks of code that contain comments?

Say I have code like this

some_line_of_code
some_line_of_code
/* some comment about code */
some_line_of_code
some_line_of_code

and i would like to comment out a whole block like this

/*
    some_line_of_code
    some_line_of_code
    /* some comment about code */
    some_line_of_code
    some_line_of_code
*/

As you can see even SO code parser will not consider last 2 lines of code comments. Is it possible to comment out blocks of code that contain comments?

edit : To clarify, I need this to be able to comment out large sections of code to check if a function I changed can compile in a package that otherwise can't be compiled until all changes have been done.

like image 791
Mladen Oršolić Avatar asked May 21 '15 13:05

Mladen Oršolić


People also ask

How do you comment out a whole block?

The most common way to comment out a block of code in Python is using the # character. Any line of code starting with # in Python is treated as a comment and gets ignored by the compiler.

How do you comment sections of code?

The single line comment is //. Everything from the // to the end of the line is a comment. To mark an entire region as a comment, use /* to start the comment and */ to end the comment. * This is a block comment.

How do you comment out multiple lines of code in Python?

To comment out multiple lines in Python, you can prepend each line with a hash ( # ). With this approach, you're technically making multiple single-line comments.


2 Answers

In SQL Developer, I highlight all lines of PL/SQL that I want commented and use Ctrl + /.

Obviously, you would like a way to comment and uncomment multiple lines quickly. This will put -- in front of each line you have highlighted. Do the same command to uncomment.

like image 105
Tony L. Avatar answered Oct 14 '22 23:10

Tony L.


you can assign a function key through Tools > Preferences > Key Configuration (Edit / Selection / Comment Lines).

like image 39
Galileo Avatar answered Oct 15 '22 01:10

Galileo