Hello World Program in Clojure
(defn -main
(println "Hello World!"))
Clojure is based on Lisp, and it uses more or less the same Lisp syntax.
(defn)
defines the -main
function
with one expression (println "Hello World!")
,
which is a function call println
with a string argument "Hello World!"
.
In functional programming languages like Clojure, everything is an expression. There are no statements in Clojure.
If you run this program, you will get the following output, as expected:
Hello World!
What's Next
If you are interested in learning Clojure programming, then you can set up a development environment before continuing.
- Next Step: Clojure development environment setup
C C++ C# Crystal D Dart Erlang F# Go Haskell Java Javascript Julia Kotlin Lua Python Rust Scala Swift Typescript