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
9409
votes
59 answers

Can comments be used in JSON?

Can I use comments inside a JSON file? If so, how?
Michael Gundlach
  • 106,555
  • 11
  • 37
  • 41
2095
votes
23 answers

Comments in Markdown

How do you write a comment in Markdown, i.e. text that is not rendered in the HTML output? I found nothing on the Markdown project.
Betamos
  • 26,448
  • 9
  • 23
  • 28
1517
votes
53 answers

What's a quick way to comment/uncomment lines in Vim?

I have a Ruby code file open in vi, there are lines commented out with #: class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # t.string :name # t.string :all_of # …
Ethan
  • 57,819
  • 63
  • 187
  • 237
1481
votes
11 answers

How do you do block comments in YAML?

How do I comment a block of lines in YAML?
Thierry Lam
  • 45,304
  • 42
  • 117
  • 144
1405
votes
8 answers

Why is executing Java code in comments with certain Unicode characters allowed?

The following code produces the output "Hello World!" (no really, try it). public static void main(String... args) { // The comment below is not a typo. // \u000d System.out.println("Hello World!"); } The reason for this is that the Java…
Reg
  • 10,717
  • 6
  • 37
  • 54
1397
votes
27 answers

How do I create multiline comments in Python?

How do I make multi-line comments? Most languages have block comment symbols like: /* */
Dungeon Hunter
  • 19,827
  • 13
  • 59
  • 82
1121
votes
12 answers

How to "comment-out" (add comment) in a batch/cmd?

I have a batch file that runs several python scripts that do table modifications. I want to have users comment out the 1-2 python scripts that they don't want to run, rather than removing them from the batch file (so the next user knows these…
user1397044
  • 11,679
  • 6
  • 19
  • 16
1075
votes
10 answers

How do you comment out code in PowerShell?

How do you comment out code in PowerShell (1.0 or 2.0)?
labyrinth
  • 13,397
  • 7
  • 35
  • 44
898
votes
9 answers

How do I comment out a block of tags in XML?

How do I comment out a block of tags in XML? I.e. How can I comment out and everything inside it, in the code below?
Jonas
  • 121,568
  • 97
  • 310
  • 388
850
votes
10 answers

Multi-Line Comments in Ruby?

How can I comment multiple lines in Ruby?
Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
738
votes
2 answers

Comments in .gitignore?

Can you write comments in a .gitignore file? If so, should the line be preceded with a # or some other indicator?
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
630
votes
5 answers

What is the common header format of Python files?

I came across the following header format for Python source files in a document about Python coding guidelines: #!/usr/bin/env python """Foobar.py: Description of what foobar does.""" __author__ = "Barack Obama" __copyright__ = "Copyright…
Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
574
votes
24 answers

How do I add comments to package.json for npm install?

I've got a simple package.json file and I want to add a comment. Is there a way to do this, or are there any hacks to make this work? { "name": "My Project", "version": "0.0.1", "private": true, "dependencies": { "express": "3.x", …
Will Shaver
  • 12,471
  • 5
  • 49
  • 64
486
votes
4 answers

How to put a line comment for a multi-line command

I know how to write a multi-line command in a Bash script, but how can I add a comment for each line in a multiline command? CommandName InputFiles \ # This is the comment for the 1st line --option1 arg1 \ # This is the comment for…
Peter Lee
  • 12,931
  • 11
  • 73
  • 100
448
votes
4 answers

How to comment in Vim's config files: ".vimrc"?

How do I add a comment in Vim's configuration files, like .vimrc?
alexchenco
  • 53,565
  • 76
  • 241
  • 413
1
2 3
99 100