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
  • 마지막으로 수정됨: 2021/11/22 23:34
  • 저자 127.0.0.1