Comments are useful texts to describe about lines of code and improve readability of a code.
It is ignored by compiler and only for developers
Multiple ways we can write a comments in Clojure.
Clojure Comment Macro
Syntax
(comment & body)
Here is an example
(comment
;; First program.
;; Hello World.
(defn -main []
"I can say 'Hello World'."
(println "Hello, World!"))
)
Clojure Single line comments
It provides semicolon(;
) macro that starts with a single line, followed by text. text is ignored by compiler.
Single line comments canbe new line or inline comments.
; Single line comments
(+ 12 1)
Inline comments
(+ 12 1) ; inline comments
with this, You can add multiple ;
to identify heading types.
;
- used for inline or single line comments
;;
- Documentation comments for functions that contains strings
;;;
- Documentation comments for group of functions declared in a single file
;;;;
- File level comments, higher level in a file
Multi line comments
Multi lines comments allows to add comments to multiple lines of code.
Comments can be placed in multiple lines nested in ()
or []
.
Syntax