Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

when

when

type: special form (fsubr)
location: built-in
source file: xlcont.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(when  <test> [ <expr> ... ] )
        <test>          -       an expression - NIL or non-NIL
        <expr>          -       expressions comprising a body of code

DESCRIPTION

The WHEN macro executes the <expr> forms if <test> evaluates to a non-NIL value. If <test> is non-NIL, the value of the last <expr> is returned as the result. If <test> is NIL, NIL is returned with none of <expr> evaluated.

EXAMPLES

(when NIL)                              ; returns NIL
(when T)                                ; returns T
(when T (print "hi") 'foo)              ; prints  "hi"  returns FOO
(when (listp '(a))                      ;
      (print "a list"))                 ; prints  "a list"
                                        ; returns "a list"


Go to the first, previous, next, last section, table of contents.