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
8287
votes
56 answers

Can comments be used in JSON?

Can I use comments inside a JSON file? If so, how?
Michael Gundlach
  • 94,522
  • 11
  • 34
  • 39
1636
votes
18 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
  • 20,216
  • 9
  • 21
  • 27
1482
votes
12 answers

How do you do block comments in YAML?

How do I comment a block of lines in YAML?
Thierry Lam
  • 41,912
  • 39
  • 108
  • 142
1377
votes
7 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,618
  • 6
  • 28
  • 46
1312
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
  • 52,651
  • 60
  • 180
  • 231
1240
votes
23 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
  • 17,873
  • 13
  • 53
  • 78
997
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,182
  • 6
  • 30
  • 43
964
votes
11 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,099
  • 6
  • 17
  • 16
829
votes
8 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
  • 97,987
  • 90
  • 271
  • 355
782
votes
10 answers

Multi-Line Comments in Ruby?

How can I comment multiple lines in Ruby?
Mohit Jain
  • 40,277
  • 53
  • 161
  • 272
627
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
  • 82,013
  • 132
  • 311
  • 454
551
votes
4 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
  • 68,458
  • 72
  • 198
  • 283
431
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
  • 10,683
  • 5
  • 44
  • 62
385
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
  • 11,507
  • 7
  • 65
  • 97
360
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
  • 40,822
  • 34
  • 113
  • 133
1
2 3
99 100