In Clojure nil? checks for nil. How does one check for not nil?
I want to do the Clojure equivalent of the following Java code:
if (value1==null && value2!=null) {
}
Follow-up: I was hoping for a not nil check instead of wrapping it with not. if has a if-not counterpart. Is there such a counterpart for nil??
Another way to define
not-nil?would be using thecomplementfunction, which just inverts the truthyness of a boolean function:If you have several values to check then use
not-any?: