JanetDocsPlaygroundI'm feeling luckyGitHub sign in

cond



    macro
    boot.janet on line 198, column 1

    (cond & pairs)

    Evaluates conditions sequentially until the first true condition is 
    found, and then executes the corresponding body. If there are an 
    odd number of forms, and no forms are matched, the last expression 
    is executed. If there are no matches, returns nil.


1 exampleSign in to add an example
Loading...
(defn test
  [x]
  (cond
    (> x 10) "Pretty big!"
    (< x 5) "Quite small"
    "Medium size"))

(test 40) # => "Pretty big!"
(test 2) # => "Quite small"
(test 6) # => "Medium size"
pingiunPlayground