when-not

clojure.core

  • (when-not test & body)
Evaluates test. If logical false, evaluates body in an implicit do.

2 Examples top

  • user=> (map
             #(when-not (= %2 %3) [%1 %2 %3])
             (iterate inc 0)
             [:a :b :c]
             [:a :a :a])
    
    (nil [1 :b :a] [2 :c :a])
    
  • ;; See examples for "if" explaining Clojure's idea of logical true
    ;; and logical false.
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:460 top

(defmacro when-not
  "Evaluates test. If logical false, evaluates body in an implicit do."
  {:added "1.0"}
  [test & body]
    (list 'if test nil (cons 'do body)))
Vars in clojure.core/when-not:
Used in 0 other vars

Comments top

No comments for when-not. Log in to add a comment.