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 CommentPython Multiline Comments
"""
Python Multiline
Comments
"""C/C++ Comments
// C/C++ Single Line CommentC/C++ Multiline Comments
/*
C/C++ Multiline
Comments
*/Java Comments
// Java Single Line CommentJava Multiline Comments
/*
Java Multiline
Comments
*/Ruby Comments
# Ruby Single Line CommentRuby Multiline Comments
=begin
Ruby Multiline
Comments
=endPHP Comments
# PHP Single Line CommentPHP 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 LineJS Multiline Comments
/*
JavaScript Multiline
Commments
*/SQL Comments
-- SQL Single Line CommentSQL Multiline Comments
/*
SQL Multiline
Comments
*/Swift Comments
// Swift Single Comment LineSwift Multiline Comments
/*
Swift Multiline
Comments
*/Kotlin Comments
// Kotlin Single Comment LineKotlin Multiline Comments
/*
Kotlin Multiline
Comments
*/Go Comments
// Go Single Line CommentsGo Multiline Comments
/*
Go Multiline
Comments
*/Rust Commets
// Rust Single Line CommentsRust Multiline Comments
/*
Rust Multiline
Comments
*/Haskell Comments
-- Haskell Single Line CommentsHaskell Multiline Comments
{-
Haskell Multiline
Comments
-}TypeScript Comments
// TypeScript Single Line CommentTypeScript Multiline Comments
/*
TypeScript Multiline
Comments
*/MATLAB Comments
% MATLAB Single Line CommentMATLAB Multiline Comments
%{
MATLAB Multiline
Comments
%}R Comments
# R Single Line CommentsR Multiline Comments
if (FALSE) {
R Multiline
Comments
}Perl Comments
# Perl Single Line CommentPerl Multiline Comments
=pod
Perl Multiline
Comments
=cutBash/Shell Comments
# Bash/Shell Single Line CommentsBash/Shell Multiline Comments
: '
This is a
multi-line comment
'