Clojure-snips: Equality in Clojure

Clojure allows you to test for equality using the equals(=) sign.

;you can compare two things
(= 1 1) ;true

;you can compare multiple things
(= 1 1 1) ;true 

;if any of them are not equal then we get false
(= 1 1 2) ;false

;if something is not strictly equal then we get false
(= 2 2.0) ;false

;but we can also check for loose equality (Notice two equals)
(== 2 2.0) ;true

;and it's not just numbers that can be compared
;see? didn't need anything special for strings
(= "abc" (str "a" "b" "c")) ;true

;nil (other languages call it null) can be compared the same way
(= nil nil)

Writing about Clojure

It’s been a while since I wrote on this blog. Been busy in many things. Recently I decided to start learning Clojure. I thought the best way to keep at it would be to start writing about it. So I decided that I am going to start writing posts every now and then about anything I learn in Clojure.  Inspired by Groovy Goodness I’ll try to work on “Clojure-snips”. Hopefully I will improve with time as I learn Clojure.

Getting Started

Clojure features

I’ll also keep a list of references here. Whatever I referred or helped me in learning Clojure.