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

oddp


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

Syntax

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

Description

The 'oddp' predicate function checks to see if the number 'expr' is odd.  T  is returned if the number is odd, 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

(oddp 0)     ; returns NIL
(oddp 1)     ; returns T
(oddp 2)     ; returns NIL
(oddp -1)    ; returns T
(oddp -2)    ; returns NIL

(oddp 13.0)  ; error: bad floating point operation
(oddp 'a)    ; error: bad argument type
(setq a 3)   ; set value of A to 3
(oddp a)     ; returns T

See the oddp predicate function in the XLISP 2.0 manual.

  Back to Top


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