19

When I say “comment out”, does it mean to uncomment something or comment it?

meaning – When I say “comment out”, does it mean to uncomment something or comment it? – English Language & Usage Stack Exchange

Stack Exchange Network

Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
  1. 0
  2. +0
  3. Log in Sign up

English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.

Sign up to join this community

Anybody can ask a question

Anybody can answer

The best answers are voted up and rise to the top

Asked 9 years, 9 months ago

Viewed 145k times

When I say “comment out”, does it mean to uncomment something or comment it?
What is better, or more correctly used?

PS: I’m talking about source code.

asked Jul 9 ’11 at 11:48

genesisgenesis

2,29388 gold badges2323 silver badges3333 bronze badges

0

To comment out is to render a block of code inert by turning it into a comment.

In C# code for example, commenting out code is done by putting // at the start of a line, or surrounding the code with /* and */. Here the line inside the loop is commented out:

for (int i = 0; i < 10; i++) { //Console.WriteLine(i); }

To uncomment something means to remove the characters that makes it a comment. The expression only makes sense if the comment contains something that would work as code, usually something that was commented out earlier. To uncomment a regular comment would just cause a syntax error.

answered Jul 9 ’11 at 14:31

GuffaGuffa

9,04711 gold badge2020 silver badges3131 bronze badges

“Comment out” means to use comment syntax to remove something from the parsed code. “Uncomment” is the reverse operation. They are both the correct expression for their respective referents.

answered Jul 9 ’11 at 11:52

MarcinMarcin

4,7401919 silver badges2222 bronze badges

10

As reported by the NOAD, the meaning of comment out is (computing) turn part of a program into a comment so that the computer ignores it when running the program.

You could try commenting out that line.

The definition provided by Dictionary.com is the following one:

To surround a section of code with comment delimiters or to prefix every line in the section with a comment marker. This prevents it from being compiled or interpreted.

The PC Magazine Enciclopedia defines comment out using the following words:

To disable lines of code in a program by surrounding them with comment-start and comment-stop characters.

Answers.com defines comment out as (computer science) To render a statement in a computer program inactive by making it a comment.

Comment out doesn’t mean removing a comment.

answered Jul 9 ’11 at 14:10

kiamlalunokiamlaluno

56.2k6868 gold badges200200 silver badges316316 bronze badges

2

For me when you comment it is to clarify something that will make it easier for the user to understand like in c++(although a simple example and should not be used like this):

int n = 0; //add 4 to variable n and then output it n += 4; cout << n;

But shall someone say comment out I think of the coder commenting out a line or section of code to see what happens with program execution. Such as this:

First code:

int n = 0; n += 4; cout << n;

And then commenting out a line to see what will happen with the program:

int n = 0; //n += 4; cout << n;

The first code will output 4 but when I comment out the second line it will output 0 I simply use this so that I don’t have to delete code and then rewrite it because twe

answered Jul 10 ’11 at 4:11

The idea is “remove by commenting/turning into a comment”. Note that “out” is used to mean remove in a number of phrasal verbs: “dig out”, “force out”, “smoke out” etc– and indeed, on more or less the same analogy “wipe out”.

As the opposite, you can “uncomment” a line/section, or you “comment it back in”. The latter is slightly odd, because logically you are uncommenting so that the code to be put back in. But hey, language doesn’t always use the same logic as mathematics.

answered Jul 9 ’11 at 13:19

Neil CoffeyNeil Coffey

18.9k11 gold badge3737 silver badges6969 bronze badges

//That is a function for calculating 2 intgers and display the result. – this is a comment int add(int a, int b) { return a+b; print(a+b); }

Now, you think the “print(a+b)” is useless, you don’t want it anymore, but you want to remain it at here in case whenever you want to reuse it. You don’t have to delete this line, you can just comment out it like that,

int add(int a, int b) { return a+b; //print(a+b); }

answered Jan 16 ’19 at 3:06

ZhangZhang

27811 silver badge99 bronze badges

Highly active question. Earn 10 reputation in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity. {};’)}catch(a){return!0}}function o(){return’undefined’!=typeof googletag&&!!googletag.apiReady}function p(){o()||(googletag={cmd:l(B)})}function q(){var a=document.createElement(‘div’);a.className=’adsbox’,a.id=’clc-abd’,a.style.position=’absolute’,a.style.pointerEvents=’none’,a.innerHTML=’ ‘,document.body.appendChild(a)}function r(){return Object.keys(F.ids).filter(function(a){return’clc-cpa’!=a})}function s(a){var b=a.split(‘_’)[0],c=F.ids[b],d=F.slots[c];’function’==typeof d&&(d=d(b));return{path:’/’+C+’/’+E+’/’+c+’/’+D,sizes:d,zone:c}}function t(a){try{Array.isArray(clc.dfp.slotsRenderedEvents)||(clc.dfp.slotsRenderedEvents=[]),clc.dfp.slotsRenderedEvents.push(a);var b=a.slot.getSlotElementId(),c=[];b||c.push(‘id=0’);var d=document.getElementById(b);if(!b||d?d.hasAttribute(‘data-clc-stalled’)&&c.push(‘st=1’):c.push(‘el=0’),0!==c.length)return void G(c.join(‘&’));var e=s(b),f=e.zone;if(clc.collapse&&clc.collapse[f]&&a.isEmpty)return h(d),void d.setAttribute(‘data-clc-ready’,’true’);if(-1!==y.dh.indexOf(a.lineItemId))h(d);else if(a.lineItemId){d.setAttribute(‘data-clc-prefilled’,’true’);var j=d.parentElement;if(j.classList.contains(‘js-zone-container’)){g(j);var k=j.querySelectorAll(‘.js-report-ad-button-container’),l=k[0];switch(l.style.height=’24px’,b){case’dfp-tlb’:case’dfp-tag’:{j.classList.add(‘mb8′);break}case’dfp-mlb’:case’dfp-smlb’:case’dfp-bmlb’:{j.classList.add(‘my8′);break}case’dfp-isb’:{j.classList.add(‘mt24′);break}case’dfp-m-aq’:{j.classList.add(‘my12’),j.classList.add(‘mx-auto’);break}default:}i(j),i(d)}else i(d);if(‘dfp-msb’==b){var m=document.getElementById(‘hireme’);h(m)}}d.setAttribute(‘data-clc-ready’,’true’)}catch(a){var n=document.querySelector(‘#dfp-tsb, #dfp-isb, #clc-tsb’);n&&n.setAttribute(‘data-clc-ready’,’true’),G(‘e=1’)}}function u(a,b){‘dfp-isb’===a&&b.setTargeting(‘Sidebar’,[‘Inline’]),’dfp-tsb’===a&&b.setTargeting(‘Sidebar’,[‘Right’]);var c=s(a),d=c.path,e=c.sizes,f=c.zone,g=googletag.defineSlot(d,e,a);g.addService(b),!1;var h=a.split(‘_’);if(‘clc-cpa’==h[0]&&h[1]){var i=h[1];g.setTargeting(‘talent-company-id’,i)}}function v(b){var c=a.dfp&&a.dfp.targeting||{};’SystemDefault’===c.ProductVariant&&(window.matchMedia&&window.matchMedia(‘(prefers-color-scheme: dark)’).matches?c.ProductVariant=’Dark’:c.ProductVariant=’Light’),Object.keys(c).forEach(function(a){b.setTargeting(a,c[a])})}function w(a){var g=a.map(b).filter(e);return{eligible:g.filter(f).filter(d),ineligible:g.filter(c)}}function x(b){void 0===b&&(b=r());var c=[‘dfp-mlb’,’dfp-smlb’];if(!o())return p(),void googletag.cmd.push(function(){return x(b)});var d=w(b),e=d.eligible,f=d.ineligible;if(e.forEach(function(a){g(a)}),f.forEach(h),0!==e.length){y.abd&&q();var i=googletag.pubads().getSlots(),j=i.filter(function(a){return 0c.indexOf(a.id)}),m=e.filter(function(a){return!!y.ll&&0<=c.indexOf(a.id)});l.forEach(function(a){u(a.id,k),a.setAttribute('data-dfp-zone','true')}),googletag.enableServices(),l.forEach(function(a){googletag.display(a.id)}),y.ll&&(k.enableLazyLoad({fetchMarginPercent:0,renderMarginPercent:0}),m.forEach(function(a){u(a.id,k),a.setAttribute('data-clc-prefilled','true')}),m.forEach(function(a){googletag.display(a.id)}))}}var y=function(a){for(var b=[],c=1;c English Language & Usage Stack Exchange works best with JavaScript enabled

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

 


When I say “comment out”, does it mean to uncomment something or comment it?

More Story on Source:

* Source→ *

0

Publication author

offline 2 weeks

SFi Official

0
Comments: 0Publics: 1356Registration: 11-03-2021