Function: unless

unless is a macro defined in subr.el.gz.

Signature

(unless COND &rest BODY)

Documentation

If COND yields nil, do BODY, else return nil.

When COND yields nil, eval BODY forms sequentially and return value of last one, or nil if there are none.

View in manual

Probably introduced at or before Emacs version 19.8.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defmacro unless (cond &rest body)
  "If COND yields nil, do BODY, else return nil.
When COND yields nil, eval BODY forms sequentially and return
value of last one, or nil if there are none."
  (declare (indent 1) (debug t))
  (if body
      (cons 'if (cons cond (cons nil body)))
    (macroexp-warn-and-return (format-message "`unless' with empty body")
                              (list 'progn cond nil) '(empty-body unless) t)))