Commenting in Popular Programming Languages | SJB -->

This website uses cookies to ensure you get the best experience. More info...

Pages

Commenting in Popular Programming Languages

Every main programming language implements comments. Comments are ignored by the compiler and this is how a script generates it's own documentation. We know that Good code is self-documenting. We comment once we delete a chunk of code or to prevent rethink. If we build a library or framework, some sort of API documentation is very important to other developers for easy grasping. Remember to comment as often as possible. It’s important! Here is the list of comment styles of various languages_ 

Script commenting on sayham.com
Ada
-- Comment in Ada
ActionScript
// Single line comment in Action Script
/* Multi-line comment
in ActionScript */

Apple Script
-- Single line comment in Apple Script
(* Multi-line comment
in ActionScript *)

Assembly
# Comment in Assembly Language 
Basic
REM Comment in Basic
Bash Script
# Comment in Bash Script
C#
// Comment in C#
/* Multi-line comment
in C# */

C
/* Comment in C. This comment syntax is guaranteed to work on every compiler */
// Comment in C. but it might present portability challenges
Clojure
; Comment in Clojure
Cobol
* Comment in Cobol
CoffeScript
# Comment in CoffeScript
ColdFusion
<!--- Comment in ColdFusion --->
CSS
/* Comment in CSS */
Curl
| Single Line Comment in Curl
|# Multi-line comment 
in Curl #|

D
// Comment in D
/+ Multi-line comment
in D +/

Delphi
// Single line comment in Delphi 
{ Multi-line comment
in Delphi }

Elixir
% Comment in Elixir
Erlang
% Comment in Erlang
Fortran
! Comment in Fortran
Go
// Single line comment in Go
/* Multi-line comment
in Go */

Haskell
-- Single line comment in Haskell
{- Multi-line comment
in Haskell -}

HTML
<!-- Comment in HTML-->
Java
// Single line comment in Java
/* Multi-line comment
in Java */

     /** Multi-line documentation comment
in Java */

Javascript
// Comment in Javascript
/* Multi-line comment
in JavaScript */

Kotlin
// Comment in Kotlin
/* Multi-line comment
in Kotlin */

LAN
<!-- Comment in Lan -->
LaTex
% Comment in LaTex
Lua
-- Single line comment in Lua
--[[Multi line comment 
in Lua--]]

Matlab
% Comment in Matlab
%{ Multi line comment 
in Matlab %}
Objective C
// Comment in Objective C
/* Multi-line comment
in Objective C */

Pascal
{ Single line comment in Pascal }
{* Multi-line comment
in Pascal *}

Perl
# Comment in Perl
PHP
// Comment in PHP
PowerShell
# Single line comment in PowerShell
<# Multi-line comment
in PowerShell #>

Python
# Comment in Python
""" Multi line comment 
in Python """

R
# Single line comment in R
<# Multi-line comment
in R #>

Ruby
# Comment in Ruby
Rust
// Single line comment in Rust 
/* Multi-line comment
in Rust */

S-Lang
% Comment in S-Lang
Scala
// Single Line Comment in Scala
/* Multi line comment 
in Scala */

SPARK
-- Comment in SPARK
SQL
-- Comment in SQL
Swift
// Comment in Swift
/* Multi line comment 
in Swift */

TCL
# Single line comment in TCL
<# Multi-line comment
in TCL #>

TSQL
-- Comment in TSQL
/* Multi-line comment
in TSQL */

VB
' Comment in VB
XML
<!-- Comment in XML -->
LISP
; Single line comment in XML
#| Multi-line comment
in LISP |#

No comments:

Post a Comment