Clojure: Comment Syntax
Line Comment
Comment start with SEMICOLON to end of line.
; comment start with semicolon
;; by lisp convention ;; comment on a line by itself start with 2 semicolons (+ 3 4) ; comment after a expression start with one semicolon
Block Comment
Comment can also be written as (comment …)
, but the comment body must be a valid lisp syntax, cannot be any character.
This returns nil
.
;; comment can also be written as (comment …) (comment this is a block comment. (comment block comment can be nested.) )
;; comment body must be valid clojure syntax. ;; a semicolon by itself is not (comment : ) ;; compiler error
You usually use this form (comment …)
to comment out a block of Clojure code.
;; (comment …) is usually used to comment out block of code (comment (+ 3 4) )