Clojure – pos?

Clojure pos?

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

Syntax

Following is the syntax.

(pos? number)

Example

Following is an example for the pos test function.

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

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

Output

The above program produces the following output.

false
false
true

Next Topic : Click Here

This Post Has One Comment

Leave a Reply