无涯教程-Clojure - neg?函数

56 阅读1分钟

如果number小于零,则返回true,否则返回false。

neg? - 语法

以下是语法。

(neg? number)

neg? - 示例

以下是neg测试函数的示例。

(ns clojure.examples.hello
   (:gen-class))

;; This program displays Hello Learnfk (defn Example [] (def x (neg? -1)) (println x)

(def x (neg? 0)) (println x)

(def x (neg? 1)) (println x)) (Example)

上面的程序产生以下输出。

true
false
false

参考链接

www.learnfk.com/clojure/clo…