Clojure-neg
提供:Dev Guides
Clojure-ネガ?
数値がゼロより小さい場合はtrueを返し、そうでない場合はfalseを返します。
構文
構文は次のとおりです。
(neg? number)
例
以下は、否定テスト関数の例です。
(ns clojure.examples.hello
(:gen-class))
;; This program displays Hello World
(defn Example []
(def x (neg? -1))
(println x)
(def x (neg? 0))
(println x)
(def x (neg? 1))
(println x))
(Example)
出力
上記のプログラムは、次の出力を生成します。
true
false
false