Clojure – odd?

Clojure odd?

In this guide, we will discuss Clojure odd. Returns true if the number is odd, and throws an exception if the number is not an integer.

Syntax

Following is the syntax.

(odd? number)

Example

Following is an example of the odd test function.

(ns clojure.examples.hello
   (:gen-class))
;; This program displays Hello World
(defn Example []
   (def x (odd? 0))
   (println x)
   
   (def x (odd? 2))
   (println x)
   
   (def x (odd? 3))
   (println x))
(Example)

Output

The above program produces the following output.

false
false
true

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply