You're viewing version 1.2.0 of even?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

even?

clojure.core

  • (even? n)
Returns true if n is even, throws an exception if n is not an integer

2 Examples top

  • user=> (even? 2)
    true
    
    user=> (even? 1)
    false
  • user=> (filter even? (range 10))
    (0 2 4 6 8)
Log in to add / edit an example.

See Also top

  • 0
    clojure.core/odd?

    Returns true if n is odd, throws an exception if n is not an integer

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:1088 top

(defn even?
  "Returns true if n is even, throws an exception if n is not an integer"
  {:added "1.0"}
  [n] (zero? (bit-and n 1)))
Vars in clojure.core/even?: bit-and defn zero?

Comments top

No comments for even?. Log in to add a comment.