Function: when

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

Signature

(when COND &rest BODY)

Documentation

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

When COND yields non-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.20.

Source Code

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