XLISP zerop

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# zerop

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

## Syntax

(zerop expr)
  expr - the numeric expression to check
  returns - T if the number is zero, NIL otherwise

## Description

The 'zerop' predicate function checks to see if the number 'expr' is zero. T is returned if the number is zero, NIL is returned otherwise. An error is generated if the 'expr' is not a numeric expression:

    error: bad argument type

## Examples

    (zerop 0)                ; returns T
    (zerop 0.0)              ; returns T
    (zerop 99999.9)          ; returns NIL
    (zerop -0.000000000002)  ; returns NIL

    (zerop 'a)               ; error: bad argument type
    (setq a 0)               ; set value of A to 0
    (zerop a)                ; returns T

See the zerop predicate function in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference