store/[org.clojure/clojure "1.8.0"] clj::clojure.core/when

Official Documentation

Add notes
Arities
==================================================
   [test & body]

Docstring
==================================================
  Evaluates test. If logical true, evaluates body in an implicit do.

Source

(defmacro when
  "Evaluates test. If logical true, evaluates body in an implicit do."
  {:added "1.0"}
  [test & body]
  (list 'if test (cons 'do body)))

Example 1

Edit
;; See examples for "if" explaining Clojure's idea of logical true
;; and logical false.

Example 2

Edit
(when (= 1 1) true)
;; => true

(when (not= 1 1) true)
;; => nil

Example 3

Edit
(def has-value (when true
                 (println "Hello World")
                 "Returned Value"))
;; > Hello World
;; => #'user/has-value

has-value
;; => "Returned Value"

Uses on crossclj