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
217
votes
9 answers

/** and /* in Java Comments

What's the difference between /** * comment * * */ and /* * * comment * */ in Java? When should I use them?
Dev
  • 13,492
  • 19
  • 81
  • 174
216
votes
2 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
  • 55,199
  • 118
  • 297
  • 429
207
votes
10 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
  • 3,007
  • 6
  • 24
  • 18
199
votes
17 answers

How to comment a block in Eclipse?

Does Eclipse have a hot key to comment a block? and to uncomment a block?
snakile
  • 52,936
  • 62
  • 169
  • 241
196
votes
8 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
  • 141
  • 372
  • 590
196
votes
4 answers

What are the new documentation commands available in Xcode 5?

One of Xcode 5's new features is the ability to document your own code with a special comment syntax. The format is similar to doxygen, but appears to only support a subset of those features. Which commands are supported, and which ones aren't? Do…
Senseful
  • 86,719
  • 67
  • 308
  • 465
196
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
  • 17,918
  • 22
  • 68
  • 123
194
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,712
  • 7
  • 32
  • 29
190
votes
21 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
  • 13,475
  • 17
  • 66
  • 105
187
votes
9 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
  • 9,075
  • 11
  • 44
  • 55
162
votes
12 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
  • 56,214
  • 69
  • 228
  • 381
159
votes
4 answers

PHP function comments

I've seen that some PHP functions are commented at the top, using a format that is unknown to me: /** * * Convert an object to an array * * @param object $object The object to convert * @return array * */ My IDE gives me a dropdown…
Zim
  • 5,403
  • 7
  • 27
  • 19
158
votes
9 answers

Comment the interface, implementation or both?

I imagine that we all (when we can be bothered!) comment our interfaces. e.g. /// /// Foo Interface /// public interface Foo { /// /// Will 'bar' /// /// Wibble…
ng5000
  • 12,330
  • 10
  • 51
  • 64
156
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,375
  • 7
  • 26
  • 29
152
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,575
  • 3
  • 13
  • 21