Comments in Programming Languages
01/03/2025

In programming, developers use comments to leave notes within the code. The syntax of comments varies between programming languages.
Language | Single Line Comment | Multiline Comment |
C/C++ | // C/C++ Single Line Comment | /* C/C++ Multiline Comments */ |
Java | // Java Single Line Comment | /* Java Multiline Comments */ |
Python | # Python Single Line Comment | “”” Python Multiline Comments “”” |
JavaScript | // JavaScript Single Line Comment | /* JavaScript Multiline Comments */ |
Ruby | # Ruby Single Line Comment | =begin Ruby Multiline Comments =end |
PHP | // veya # PHP Single Line Comment | /* PHP Multiline Comments */ |
HTML | <– HTML Comment –> | <– HTML Comments –> |
CSS | /* CSS Comment */ | /* CSS Comments */ |
SQL | — SQL Single Line Comment | /* SQL Multiline Comments */ |
Bash/Shell | # Bash/Shell Single Line Comment | : ‘ Bash/Shell Multiline Comments ‘ |
Perl | # Perl Single Line Comment | =pod Perl Multiline Comments =cut |
Swift | // Swift Single Line Comment | /* Swift Multiline Comments */ |
R | # R Single Line Comment | if (FALSE) { R Multiline Comments } |
MATLAB | % MATLAB Single Line Comment | %{ MATLAB Multiline Comments %} |
Kotlin | // Kotlin Single Line Comment | /* Kotlin Multiline Comments */ |
Go | // Go Single Line Comment | /* Go Multiline Comments */ |
Rust | // Rust Single Line Comment | /* Rust Multiline Comments */ |
Haskell | — Haskell Single Line Comment | {- Haskell Multiline Comments -} |
TypeScript | // TypeScript Single Line Comment | /* TypeScript Multiline Comments */ |
Python Comments
# Python Single Line Comment
Python Multiline Comments
"""
Python Multiline
Comments
"""
C/C++ Comments
// C/C++ Single Line Comment
C/C++ Multiline Comments
/*
C/C++ Multiline
Comments
*/
Java Comments
// Java Single Line Comment
Java Multiline Comments
/*
Java Multiline
Comments
*/
Ruby Comments
# Ruby Single Line Comment
Ruby Multiline Comments
=begin
Ruby Multiline
Comments
=end
PHP Comments
# PHP Single Line Comment
PHP Multiline Comments
/*
PHP Multiline
Comments
*/
HTML Comments
<!-- HTML Comments -->
CSS Comments
/* CSS Comments */
For detailed information about its usage, click on the CSS comment line.
JS Comments
// Javascript Single Comment Line
JS Multiline Comments
/*
JavaScript Multiline
Commments
*/
SQL Comments
-- SQL Single Line Comment
SQL Multiline Comments
/*
SQL Multiline
Comments
*/
Swift Comments
// Swift Single Comment Line
Swift Multiline Comments
/*
Swift Multiline
Comments
*/
Kotlin Comments
// Kotlin Single Comment Line
Kotlin Multiline Comments
/*
Kotlin Multiline
Comments
*/
Go Comments
// Go Single Line Comments
Go Multiline Comments
/*
Go Multiline
Comments
*/
Rust Commets
// Rust Single Line Comments
Rust Multiline Comments
/*
Rust Multiline
Comments
*/
Haskell Comments
-- Haskell Single Line Comments
Haskell Multiline Comments
{-
Haskell Multiline
Comments
-}
TypeScript Comments
// TypeScript Single Line Comment
TypeScript Multiline Comments
/*
TypeScript Multiline
Comments
*/
MATLAB Comments
% MATLAB Single Line Comment
MATLAB Multiline Comments
%{
MATLAB Multiline
Comments
%}
R Comments
# R Single Line Comments
R Multiline Comments
if (FALSE) {
R Multiline
Comments
}
Perl Comments
# Perl Single Line Comment
Perl Multiline Comments
=pod
Perl Multiline
Comments
=cut
Bash/Shell Comments
# Bash/Shell Single Line Comments
Bash/Shell Multiline Comments
: '
This is a
multi-line comment
'