Dark theme | Light theme

April 6, 2020

Clojure Goodness: Get Clojure Version

To get the current Clojure version we must use the clojure-version function. The function simply returns the Clojure version we are using from our code.

In the following example we simply check the result of clojure-version and also define a function to get the Javaa version:

(ns mrhaki.core.version
  (:require [clojure.test :refer [is]]))

;; Function clojure-version returns Clojure version.
(is (= "1.10.1" (clojure-version)))

(defn java-version
  "Returns Java version as printable string."
  (System/getProperty "java.version"))

(is (= "14" (java-version)))

Written with Clojure 1.10.1.