How to write Comments in Programming Languages?
Comments in programming languages are used to document the programs. Comments are non-executable and are used to explain the code written in the program. Different programming languages have different syntax for writing the comments in the program. Let’s have a look at a few of them.
HTML and XML
<!-- HTML Comment, works inside body and head tag -->
<!--
HTML Comment,
works inside body and head tag
-->
CSS and JavaScript
/*
This
is
multiline
comment
*/
/* This is the Single line comment */
Javascript, JAVA, PHP, Kotlin, TypeScript, Scala, Rust and C, C#, C++
/*
This
is
multiline
comment
*/
// This is the Single line comment.
SQL
-- This is the Single line comment.
Python, Ruby, Elixir, and R
# This is the Single line comment.