Comments is a language feature.
Comments generally refer to free text ignored by the compiler that is not part of the language grammar.
Languages without Comments include JSON, Regular Expressions, JCOF
Languages with Comments include Java, JavaScript, C, Python, SQL, C++, HTML, XML, PHP, Perl, MATLAB, C#, Ruby, Fortran, MySQL, R, Go, CSS, COBOL, Ada, Scala, Swift, PostgreSQL, Rust, PowerShell, Kotlin, Pascal, ARM, Haskell, Lua, TypeScript, SAS, Prolog, Bash, Clojure, Objective-C, Mathematica, Erlang, Elixir, Visual Basic, CUDA, Dart, Julia, Scheme, Modula-2, Tcl, VBA, ActionScript, Solidity, Verilog, Reason, BASIC, Crystal, Delphi, awk, CoffeeScript, F#, Maple, Elm, OCaml, Eiffel, Modula-3, YAML, Yacc, Smalltalk, Racket, Groovy, Sage, D, Common Lisp, GraphQL, VHDL, LaTeX, Nginx, APL, Smali, OpenCL, XQuery, LLVM IR, Nim, SPSS, PostScript, Visual Basic .NET, Chapel, Red, Haxe, Rexx, WebAssembly, LFE, PureBasic, Forth, fish, ANTLR, MIPS architecture, VBScript, Lasso, CIL, Oz, Applescript, Oberon, SVG, Tex, Idris, Protocol Buffers, ABAP, AMPL, Simula, PureScript, Logo, sed, PicoLisp, V, BCPL, PL/SQL, Processing, HAML, REBOL, Hack, FLUX, DOT, Nearley, Rust MIR, idyll, MoonScript, Dylan, Terra, Fantom, Squirrel, Monkey, Jison, Agda, BlitzBasic, EuLisp, Ballerina, ColdFusion, Frege, MUMPS, Emacs Lisp, AutoIt, Zig, x86 Assembly, GNU Octave, TOML, Hy, Lean, NewLisp, Zephir, Icon, Vala, X10, Flow, Makefile, Turing, Pug, J, Scilab, QML, Mercury, Io, PL/I, IDL, xBase, Nextflow, Click, Boo, EDN, PostCSS, QBasic, Java Bytecode, Ceylon, Nemerle, SPARQL, JSON5, Object Pascal, Clean, SystemVerilog, Opa, SuperCollider, Stata, CLIPS, SNOBOL, NetLogo, Bison, HCL, AGC, Factor, API Blueprint, PL/pgSQL, Deno, odin, Isabelle, TLA, Batchfile, Ini, MiniD, Wren, Pike, ATS, ClojureScript, Dafny, eC, Csound, S-algol, Lex, B, Xojo, FoxPRO, Dhall, Perl 6, GW-BASIC, Alloy, Embedded Crystal, E, LiveScript, Modelica, AutoHotkey, halide, Clipper, Bicep, Objective-J, PEG.js, M4, wisp, Datalog, Wolfram Language, Gambas, Befunge, UrWeb, PowerBuilder, Less, Seed7, XS, GAP, Twig, Pig Latin, Classroom Object Oriented Language, YASnippet, Genie, Maxima, AspectJ, Falcon, JFlex, Transact-SQL, XBase++, starlark, FreeBASIC, SETL, Cap'n Proto, unison, KaTeX, Netwide Assembler, PRQL, Dc, DTrace, NSIS, PEG, Golo, Bluespec, Croc, WxBasic, JCL, True BASIC, Augmented Backus-Naur Form, Fennel, Ion, mlir, CWL, Sather, Oberon-2, K, LiveCode, Closure Templates, SourcePawn, WDL, Cue, CIL, Eve, Xtend, datascript, Java Properties, Ren'Py, Argdown, EBNF, Koka, Ragel, Fortress, HLSL, muPad, Unicon, HOPE, PARI/GP, Ring, XSLT, Gosu, OpenVera, SIL, Hjson, GLSL, Ron, Expect, BETA, Action!, carp, Mirah, Cg, LilyPond, PL/M, IGOR Pro, UNLAMBDA, Felix, PAWN, Pony, Taichi, Slope, JAI, P4, QB64, LPC, MQL5, Jule, Guile, Euphoria, Angelscript, beads-lang, NCAR Command Language, mgmt, KiXtart, Volt, Dockerfile, Futhark, LotusScript, Filebench WML, Spin, JADE, Yoix, NetLinx, ThinBasic, Concise Encoding, blockml, ARexx, CLOS, Cryptol, S3, LookML, Mu, OpenSCAD, Apex, BlitzMax, Aldor, Logica, Joy, DM, Gettext Catalog, ooc, Linden Scripting Language, GDScript, Neko, Nit, Eclipse Command Language, clay, Lily, PIC, ShaderLab, FutureBASIC, Mask, Tea, Turbo Basic, ArkScript, StarOffice Basic, Harbour, Whiley, zephyr-asdl, COMPONENT PASCAL, POV-Ray SDL, carth, SugarSS, CartoCSS, Ch, Jasmin, RenderScript, Literate Agda, Fancy, WebIDL, Game Maker Language, Observable, storyscript, PowerBASIC, Praat Script, Refal, Edje Data Collection, Objective C++, Not Quite C, omega, OX, Alpine Abuild, Slice, mun-lang, CLIST, OpenEdge ABL, SimCode, ECL, BLISS, JSON with Comments, Vigil, GCC Machine Description, ActiveVFP, Shen, Fibonacci, Brightscript, Reia, SCSS, MVEL, Script.NET, Cycript, winxed, Raku, Caché Basic, SMT, Ezhil, NetRexx, Strips, spry, Logtalk, Spatial, Pan, Cell, Not eXactly C, SRecode Template, Flow9, Mary, Creative Basic, MAXScript, LoomScript, Type Language, MOO, Treelang, Arden syntax, dex, Operational Control Language, VHDL-AMS, Bel, Fable, c3, Opal, FML, Handel-C, Cypher Query Language, XBLite, Logos, lispyscript, Lingo, ACL2, Gerbil Scheme, Maya Embedded Language, HiveQL, Quaint, Dale, Guix Workflow Language, basic calculator, MACRO-10, KRL, Module Management System, turnstile, NS Basic, S-PLUS, tht, monte, Q#, dslx, Plus, Xbasic, NestedText, neut, OCL, BitBake, Gentoo Ebuild, Vale, gentee, Rescript, spiral, Grammatical Framework, PROMAL, HAGGIS, Redcode, Mako, Simple Actor Language System and Architecture, Frink, Parser 3, Rc, CIR, Gherkin, flagship, RELAX NG, JSLT, DAX, Orc, ddfql, Hocon, neeilang, hilvl, PowerQuery M, Tuple space, Yet Another Scripting Language, Recfiles, holyc, CFScript, Parrot BASIC, txr, Zimpl, Nymph, Jsonnet, Boron, Ren, Mouse, Language Server Index Format, Ligo, NESL, Adventure Game Studio Script, C shell, Charity, dlvm, epsilon, GraphQL Schema Definition Language, Z, JS++, Pawn, manool, Uniform eXchange Format, Judoscript, Finite State Language, Soy, HuJSON, silk, Augeas, Claro, Fjölnir, z80, owen-lang, verifpal, StruQL, Yedalog, kai, BuddyScript, fizz, JSL, ldpl, OEM, popr, Easytrieve, Lite-C, Structured Query Reporter, Sophia, parasail, Manchester syntax, dedukti, pointless, Project Mentat, tremor-query, Heron, taf, atomese, TAL, Reactive Plan Language, FloScript, Action Code Script, XPL0, ISETL, Boogie, rosette-lang, xxl, Bla, False, Lexon, Urbiscript, ca65 Assembly, ctalk-lang, rbs, Pnuts, Portable Bit Map Format, Wart, stella, Savi, OptimJ, ProbeVue, AmbientTalk, Plot, Netpbm grayscale image format, Amazon Redshift, USD, wescheme, Robots.txt, lain, luau, bioscript, ppm-format, sora, SubX, RLaB, blz, Sweet Expressions, Rita, KonsolScript, boa, PromQL, Spice, SARL, rbscript, Smithy, PacmanConf, PkgConfig, BABEL, Lighttpd configuration file, SNOBOL4
/* hello world */
// hi
# This is a comment
<!-- Hello World in HTML -->
# This is a comment in perl
=begin comment
This is all part of multiline comment.
You can use as many lines as you like
These comments will be ignored by the
compiler until the next =cut is encountered.
=cut
% This is a comment
// This is a comment
# This is a single line comment.
C
C Lines that begin with 'C' (in the first or 'comment' column) are comments
C
-- A comment
# A comment
/* This is a single-line comment */ p { color: red; }
// https://doc.rust-lang.org/reference/comments.html
// a comment
{ This is a single line comment in pascal. But needs to be closed. }
; A comment
-- a single line comment
{- A multiline comment
which can continue for many lines
-}
// A comment
% hello world program
# this is a comment
/* A comment
*/
// Hi
/* Assume address is not null. */
REM This BASIC program shows the use of the PRINT and GOTO Statements.
(* This is a single-line comment. *)
(* This is a
* multi-line
* comment.
*)
(: Hello World with XQuery :)
* A comment where first character must be *.
' A comment
* => 1000000000 */
(* A comment
*)
% A comment
-# A comment
(* This is a multi-line comments
and it will span multiple lines. *)
{ This is a single line comment in pascal }
* A comment
\* A comment
REM A comment
# a '#' or ';' character indicates
; a comment
! A comment
(* A comment *)
{# A comment
#}
--- A comment
; I am a comment
// A comment
/* A comment */
@ a comment @
(* query examples *)
# This is a line comment
###
This is a block comment
###
;; A comment
''' A comment
'''
# Comments start with a # and continue to the end of the line:
{- A comment
-}
# Blah blah…
# Unlike some file formats, comments in recfiles must be complete lines. You cannot start a comment in the middle of a line.
~ A comment
-- A simple function, that is used inside the macro below.
defun ap x y
++ x
y
defmacro : input
z:string input
-- Example with print:
print : Hello, World!
What's going on in here?
# <This is a comment>
__ A comment
(; This is a comment ;)
COMMENT A comment