Clojure – even?

Clojure neg?

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

Syntax

Following is the syntax.

(even? number)

Example

Following is an example of the even test function.

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

;; This program displays Hello World
(defn Example []
   (def x (even? 0))
   (println x)
   
   (def x (even? 2))
   (println x)
   
   (def x (even? 3))
   (println x))
(Example)

Output

The above program produces the following output.

true
true
false

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply