open:loop

loop

loop [binding]
(condition
   (statement)
   (recur (binding))

loop_statement.jpg

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

;; This program displays Hello World
(defn Example []
   (loop [x 10]
      (when (> x 1)
         (println x)
         (recur (- x 2))))) 
(Example)

Output

10
8
6
4
2

  • open/loop.txt
  • Last modified: 2024/10/05 06:15
  • by 127.0.0.1