XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

unless


Type:   -   special form (fsubr)
Source:   -   xlcont.c

Syntax

(unless test [expr ... ])
test - an expression, NIL or non-NIL
expr - expressions comprising a body of code
returns - the value of the last expression or NIL

Description

The 'unless' special form executes the 'expr' forms if 'test' evaluates to a NIL value. If 'test' is NIL , the value of the last 'expr' is returned as the result. If 'test' is non-NIL , NIL is returned with none of 'expr' evaluated.

Examples

(unless NIL)                    ; returns NIL
(unless T)                      ; returns NIL

(unless NIL (print "hi") 'foo)  ; prints "hi"  returns FOO

(unless (listp "a")
        (print "not a list"))   ; prints  "not a list"
                                ; returns "not a list"

See the unless special form in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next