목차

loop

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

loop_statement.jpg

Example

(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

Refs


관련 문서