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

5911 questions
186
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
  • 22,779
  • 27
  • 83
  • 163
178
votes
9 answers

Commenting in a Bash script inside a multiline command

How can I comment on each line of the following lines from a script? cat ${MYSQLDUMP} | \ sed '1d' | \ tr ",;" "\n" | \ sed -e 's/[asbi]:[0-9]*[:]*//g' -e '/^[{}]/d' -e 's/""//g' -e '/^"{/d' | \ sed -n -e '/^"/p' -e '/^print_value$/,/^option_id$/p'…
BassKozz
  • 2,627
  • 6
  • 22
  • 18
171
votes
3 answers

Swift: Understanding // MARK

What is the purpose of writing comments in Swift as: // MARK: This is a comment When you can also do: // This is a comment What does the // MARK achieve?
Marcus Leon
  • 50,921
  • 112
  • 279
  • 413
168
votes
7 answers

How do I comment on the Windows command line?

In Bash, # is used to comment the following. How do I make a comment on the Windows command line?
Tim
  • 1
  • 122
  • 314
  • 481
166
votes
17 answers

Is there a shortcut to make a block comment in Xcode?

I'm writing ANSI-compatible C code, and hence I can't use the line (//) comment. I'm using Xcode. In Sublime Text and Eclipse, and I think most other IDEs, there are separate keyboard shortcuts for line comments and block comments (/**/). However, I…
limp_chimp
  • 9,927
  • 12
  • 51
  • 102
152
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
  • 11,917
  • 6
  • 37
  • 52
152
votes
2 answers

How to write a comment in a Razor view?

How to write a comment in a MVC view, that won't be transmitted to the final HTML (i.e.,to browser, to response). One can make a comment with: but, it is visible in the page source code in browser. Is it possible…
horgh
  • 16,280
  • 18
  • 57
  • 114
151
votes
8 answers

Inline comments for Bash?

I'd like to be able to comment out a single flag in a one-line command. Bash only seems to have from # till end-of-line comments. I'm looking at tricks like: ls -l $([ ] && -F is turned off) -a /etc It's ugly, but better than nothing. Is there a…
Lajos Nagy
  • 7,832
  • 11
  • 41
  • 52
150
votes
6 answers

Convert PHP closing tag into comment

One of the lines in my script contains a PHP closing tag inside a string. Under normal operation this does not cause a problem, but I need to comment out the line. I have tried to comment out this line with //, /* */ and # but none of them work, the…
v1n_vampire
  • 1,459
  • 3
  • 11
  • 18
147
votes
11 answers

Can I use a hash sign (#) for commenting in PHP?

I have never, ever, seen a PHP file using hashes (#) for commenting. But today I realized that I actually can! I'm assuming there's a reason why everybody uses // instead though, so here I am. Is there any reason, aside from personal preference, to…
Hubro
  • 48,322
  • 60
  • 196
  • 344
147
votes
3 answers

How do I comment in CoffeeScript? "/* this */" doesn't work

In what ways can you comment in CoffeeScript? The documentation say you can use three hash symbols to start and close a comment block: ### Comments go here ### I've found that I can sometimes use the following two formats `// backticks allow…
Eric Hu
  • 17,470
  • 8
  • 49
  • 67
145
votes
10 answers

What is the meaning of #XXX in code comments?

I have seen this a lot in code, even vim marks it as a special case. #TODO and #FIXME are two other fix markers vim highlights but what does #XXX mean?
Jorge Vargas
  • 6,002
  • 7
  • 30
  • 29
144
votes
6 answers

How can I add comments in MySQL?

I want to add comment in SQL code. How can I do this? I'm using MySQL.
amir amir
  • 3,137
  • 7
  • 23
  • 29
136
votes
7 answers

How comment a JSP expression?

How can I comment a JSP expression like: <%= map.size() %> Is there something like <%= // map.size() %>?
kmilo
  • 407
  • 3
  • 8
  • 15
133
votes
14 answers

Simple Getter/Setter comments

What convention do you use to comment getters and setters? This is something I've wondered for quite some time, for instance: /** * (1a) what do you put here? * @param salary (1b) what do you put here? */ public void setSalary(float…
ThaDon
  • 7,212
  • 9
  • 45
  • 77