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

evenp


Type:   -   predicate function (subr)
Source:   -   xlmath.c

Syntax

(evenp expr)
expr - the integer numeric expression to check
returns -  T  if the integer is even, NIL otherwise

Description

The 'evenp' predicate function checks to see if the number 'expr' is even.  T  is returned if the number is even, NIL is returned otherwise.

An error is generated if the 'expr' is not a numeric expression:

error: bad argument type

An error is generated if the 'expr' is a floating point number:

error: bad floating point operation

Zero is an even number.

Examples

(evenp 0)     ; returns T
(evenp 1)     ; returns NIL
(evenp 2)     ; returns T
(evenp -1)    ; returns NIL
(evenp -2)    ; returns T
(evenp 14.0)  ; error: bad floating point operation
(evenp 'a)    ; error: bad argument type
(setq a 2)    ; set value of A to 2
(evenp a)     ; returns T

See the evenp predicate function in the XLISP 2.0 manual.

  Back to Top


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