Clojure – neg?

Clojure neg?

In this guide, we will discuss Clojure neg? . Returns true if number is less than zero, else false.

Syntax

Following is the syntax.

(neg? number)

Example

Following is an example of the neg test function.

(ns clojure.examples.hello
   (:gen-class))

;; This program displays Hello World
(defn Example []
   (def x (neg? -1))
   (println x)
   
   (def x (neg? 0))
   (println x)
  
   (def x (neg? 1))
   (println x))
(Example)

Output

The above program produces the following output.

true
false
false

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply