JanetDocsPlaygroundI'm feeling luckyGitHub sign in

%



    function

    (% dividend divisor)

    Returns the remainder of dividend / divisor.


See also:mod1 exampleSign in to add an example
Loading...
(defn fizzbuzz [n]
  (cond 
    (and
      (= 0 (% n 3))
      (= 0 (% n 5))) "fizzbuzz"
    (= 0 (% n 3)) "fizz"
    (= 0 (% n 5)) "buzz"
    :else n))

(fizzbuzz 1)   # 1
(fizzbuzz 3)   # "fizz"
(fizzbuzz 5)   # "buzz"
(fizzbuzz 15)  # "fizzbuzz"
cellularmitosisPlayground