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

6066 questions
8804
votes
57 answers

Can comments be used in JSON?

Can I use comments inside a JSON file? If so, how?
Michael Gundlach
  • 99,920
  • 11
  • 35
  • 39
1793
votes
20 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
  • 22,225
  • 9
  • 22
  • 27
1481
votes
12 answers

How do you do block comments in YAML?

How do I comment a block of lines in YAML?
Thierry Lam
  • 43,046
  • 39
  • 111
  • 143
1396
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
  • 9,850
  • 6
  • 31
  • 48
1380
votes
49 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
  • 54,501
  • 62
  • 184
  • 236
1320
votes
24 answers

Is there a way to create multiline comments in Python?

I have recently started studying Python, but I couldn't find how to implement multi-line comments. Most languages have block comment symbols like /* */ I tried this in Python, but it throws an error, so this probably is not the correct way. Does…
Dungeon Hunter
  • 18,853
  • 13
  • 58
  • 80
1035
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
  • 12,710
  • 6
  • 32
  • 44
1023
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
  • 10,689
  • 6
  • 17
  • 16
858
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
  • 107,518
  • 91
  • 288
  • 366
814
votes
10 answers

Multi-Line Comments in Ruby?

How can I comment multiple lines in Ruby?
Mohit Jain
  • 41,615
  • 54
  • 164
  • 272
675
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
  • 86,319
  • 138
  • 320
  • 459
581
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
  • 71,776
  • 75
  • 202
  • 287
475
votes
20 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
  • 11,313
  • 5
  • 48
  • 63
423
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,085
  • 10
  • 68
  • 98
379
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
  • 49,865
  • 72
  • 225
  • 398
1
2 3
99 100