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
clojure_numbers.htm
Advertisements