Questions tagged [comments]

A comment is a programming language construct used to embed non-compiled, programmer-readable annotations in the source code of a computer program.

In computer programming, a comment is a programming language construct used to embed programmer-readable annotations in the source code of a computer program.

Those annotations are potentially significant to programmers but are generally ignored by compilers and interpreters. Comments are usually added with the purpose of making the source code easier to understand. The syntax and rules for comments vary and are usually defined in a programming language specification.

The comment syntax can also be appropriated for consumption by a documentation generator tool.

Related Links

6274 questions
424
votes
12 answers

Way to create multiline comments in Bash?

I have recently started studying shell script and I'd like to be able to comment out a set of lines in a shell script. I mean like it is in case of C/Java : /* comment1 comment2 comment3 */` How could I do that?
Enes Malik Turhan
  • 4,342
  • 3
  • 9
  • 9
388
votes
1 answer

Can I add comments to a pip requirements file?

I'd like to add comments for a few packages in a pip requirements file. (Just to explain why that package is on the list.) Can I do this? I'm imagining something like Babel==0.9.5 # translation CherryPy==3.2.0 # web server Creoleparser==0.7.1 # wiki…
lofidevops
  • 15,528
  • 14
  • 79
  • 119
380
votes
4 answers

What does '# noqa' mean in Python comments?

While searching through a Python project, I found a few lines commented with # noqa. import sys sys.path.append(r'C:\dev') import some_module # noqa What does noqa mean in Python? Is it specific to Python only?
Ishpreet
  • 5,230
  • 2
  • 19
  • 35
359
votes
518 answers

What is the best comment in source code you have ever encountered?

What is the best comment in source code you have ever encountered?
Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139
334
votes
8 answers

How to comment and uncomment blocks of code in the Office VBA Editor

In the VBA editor of Office (ALT + F11), how do you comment or uncomment a block of code?
RemarkLima
  • 11,639
  • 7
  • 37
  • 56
327
votes
10 answers

Which comment style should I use in batch files?

I've been writing some batch files, and I ran into this user guide, which has been quite informative. One thing it showed me was that lines can be commented not just with REM, but also with ::. It says: Comments in batch code can be made by using a…
MikeFHay
  • 8,562
  • 4
  • 31
  • 52
282
votes
18 answers

Why doesn't Python have multiline comments?

OK, I'm aware that triple-quotes strings can serve as multiline comments. For example, """Hello, I am a multiline comment""" and '''Hello, I am a multiline comment''' But technically speaking these are strings, correct? I've googled and…
CoolGravatar
  • 5,408
  • 7
  • 35
  • 42
281
votes
8 answers

Best way to add comments in erb

How do we add comments in erb files, if we do not want them to be generated into the html content?
Kalyan Maddu
  • 4,123
  • 2
  • 21
  • 26
278
votes
5 answers

Where is the syntax for TypeScript comments documented?

Is the syntax for TypeScript comments documented anywhere? And by any chance, does it now support the C# /// system?
David Thielen
  • 28,723
  • 34
  • 119
  • 193
273
votes
8 answers

Can a CSV file have a comment?

Is there any official way to allow a CSV formatted file to allow comments, either on its own line OR at the end of a line? I tried checking wikipedia on this and also RFC 4180 but both do not mention anything which leads me to believe that it's not…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
270
votes
44 answers

What is self-documenting code and can it replace well documented code?

I have a colleague who insists that his code doesn't need comments, it's "self documenting." I've reviewed his code, and while it's clearer than code which I've seen others produce, I still disagree that self-documenting code is as complete and…
Adam Davis
  • 91,931
  • 60
  • 264
  • 330
247
votes
4 answers

Jenkins: Can comments be added to a Jenkinsfile?

Are comments possible in a Jenkinsfile? If so, what's the syntax? I am using the declarative pipeline syntax. I want to comment out the "post" section below until my SMTP server is working. pipeline { agent { label 'docker-build-slave' } …
danday74
  • 52,471
  • 49
  • 232
  • 283
227
votes
8 answers

Is there a way to comment out markup in an .ASPX page?

Is there a way to comment out markup in an .ASPX page so that it isn't delivered to the client? I have tried the standard comments but this just gets delivered as a comment and doesn't prevent the control from rendering.
MikeJ
  • 14,430
  • 21
  • 71
  • 87
220
votes
2 answers

What is the syntax for writing comments in build.gradle file?

Looking down this build.gradle file apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { applicationId "package.myapp" minSdkVersion 19 …
Machado
  • 14,105
  • 13
  • 56
  • 97
219
votes
4 answers

In VS Code, disable error "Comments are not permitted in JSON"

I sometimes use Visual Studio Code to edit JSON files that include comments. VS Code displays an error saying, "Comments are not permitted in JSON." It would be nice to disable that error message (without having to remove the comments.)
Wallace Kelly
  • 15,565
  • 8
  • 50
  • 71