Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
when
Type: |
- |
special form (fsubr) |
Source: |
- |
xlcont.c |
Syntax
- (when 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 '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"
See the
when
special form in the XLISP 2.0 manual.
Back to Top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference