(def n -42)
;; Clojure 没有三元运算符,也不需要:if 是表达式,
;; 它本身就返回所选分支的值
(def classify (if (pos? n) "positive" "negative"))
;; classify is "negative"
(println "number" n "is" classify)
;; 所以 if 可以出现在任何能放值的地方
(println (str "abs of " n " is " (if (neg? n) (- n) n)))
;; else 分支为 nil 时,"when" 能说得更简短
(println "negative?" (when (neg? n) "yes"))