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.

if

if

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

SYNTAX

(if <test-expr>  <then-expr>   [ <else-expr> ]  )
        <test-expr>     -       an expression 
        <then-expr>     -       the THEN-CLAUSE, an expression
        <else-expr>     -       the ELSE-CLAUSE, an optional expression

DESCRIPTION

The IF special form evaluates the <test-expr>. If <test-expr> evaluates to a non-NIL value, then <then-expr> is evaluated and returned as the result. If <test-expr> evaluates to NIL and there is an <else-expr>, then the <else-expr> is evaluated and its result is returned. If there is no <else-expr> and <test-expr> evaluates to NIL, then NIL is returned as a result.

EXAMPLES

(if T (print "will print")              ; prints  "will print"
      (print "won't print"))            ;
(if NIL (print "won't print")           ;
        (print "will print"))           ; prints  "will print"
(if 'a T NIL)                           ; returns T
(if NIL 'nope 'yep)                     ; returns YEP


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