1

I am looking for the correct verb for turning code into comment and comment into code in programming.

I have ______ the code, so it is a comment now. No need to delete it!

I have ______ the comment, so it is now code again. I am glad you didn't delete it!

I believe the first one is "comment out" but I am not sure. I don't know whether the second actually has got a word.

(Technically I am asking for two words here.)

shuhalo
  • 1,165

1 Answers1

2

Based on practical experience, not dictionary definition:

I have commented (out) the code. It is now a comment.

"out" is optional, in my experience. I hear it both ways.

I have uncommented the code. It is now no longer a comment.

Note also that Visual Studio itself uses this phrasing:

enter image description here

And also JetBrains Rider:

enter image description here

Flater
  • 7,767
  • 1
    Is "out" really optional? For me "I have commented the code" means: "I have written a comment explaining the code". – RoToRa Aug 21 '20 at 13:44
  • @RoToRa: By itself, it's ambiguous. But in context, it's usually understood which is meant, e.g. "the mail sender is broken, so I've commented the code for now" is perfectly understandable. My answer is based on practical usage, and "to comment the code" is in practice being used to mean "I have turned the code into a comment" – Flater Aug 21 '20 at 13:51
  • @RoToRa I have commented the code is ambiguous, and it could mean either. But just because it's ambiguous, that doesn't mean you can't use it. I've heard it used many times in both senses. It's understood by context, just as any other ambiguous word or phrase is understood by context. – Jason Bassford Aug 21 '20 at 13:51