Comment (computer programming)

An illustration of Java source code with prologue comments indicated in red and inline comments in green . Program code is in blue.

Programmer-readable explanation or annotation in the source code of a computer program.

- Comment (computer programming)

119 related topics


Source code

Simple C-language source code example, a procedural programming language. The resulting program prints "hello, world" on the computer screen. This first known "Hello world" snippet from the seminal book The C Programming Language originates from Brian Kernighan in the Bell Laboratories in 1974.
A more complex Java source code example. Written in object-oriented programming style, it demonstrates boilerplate code. With prologue comments indicated in red, inline comments indicated in green, and program statements indicated in blue.

In computing, source code is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text.

Syntax highlighting

Feature of text editors that are used for programming, scripting, or markup languages, such as HTML.

HTML syntax highlighting

The comment at the beginning is also highlighted in a specific manner to distinguish it from working code.

Lua (programming language)

Lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications.

A comment in Lua starts with a double-hyphen and runs to the end of the line, similar to Ada, Eiffel, Haskell, SQL and VHDL.

Lexical analysis

Process of converting a sequence of characters into a sequence of lexical tokens (strings with an assigned and thus identified meaning).

Charles Babbage, sometimes referred to as the "father of computing".

In older languages such as ALGOL, the initial stage was instead line reconstruction, which performed unstropping and removed whitespace and comments (and had scannerless parsers, with no separate lexer).

Visual Basic .NET

Multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework.

Hello world! window

A single quotation mark (') or the keyword, placed at the beginning of a line or after any number of space or tab characters at the beginning of a line, or after other code on a line, indicates that the (remainder of the) line is a comment.

Documentation generator

Programming tool that generates software documentation intended for programmers or end users (end-user guide), or both, from a set of source code files, and in some cases, binary files.

A diagram from 1978 proposing the expansion of the idea of the API to become a general programming interface, beyond application programs alone.

Some generators, such as Javadoc, can use special comments to drive the generation.

Computer programming

Process of performing a particular computation , usually by designing and building an executable computer program.

Ada Lovelace, whose notes added to the end of Luigi Menabrea's paper included the first algorithm designed for processing by an Analytical Engine. She is often recognized as history's first computer programmer.
Data and instructions were once stored on external punched cards, which were kept in order and arranged in program decks.
Wired control panel for an IBM 402 Accounting Machine.
The first known actual bug causing a problem in a computer was a moth, trapped inside a Harvard mainframe, recorded in a log book entry dated September 9, 1947. "Bug" was already a common term for a software defect when this bug was found.


Java (programming language)

High-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

Duke, the Java mascot
James Gosling, the creator of Java, in 2008.
The TIOBE programming language popularity index graph from 2002 to 2018. Java was steadily on the top from mid-2015 to early 2020.
Dependency graph of the Java Core classes (created with jdeps and Gephi)

Java uses comments similar to those of C++.

Text editor

Type of computer program that edits plain text.

Editors like Leafpad, shown here, are often included with operating systems as a default helper application for opening text files.
A box of punched cards with several program decks.
Emacs, a text editor popular among programmers, running on Microsoft Windows
gedit is a text editor shipped with GNOME

Text formatting – Text editors often provide basic visual formatting features like line wrap, auto-indentation, bullet list formatting using ASCII characters, comment formatting, syntax highlighting and so on. These are typically only for display and do not insert formatting codes into the file itself.


Open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other serializable values).

Douglas Crockford at the Yahoo Building (2007)

JSON does not provide syntax for comments.