Returning a value from a loop
clojure
Solution
the return value of the loop will be the retrun value of the if statement
(loop [ins inputs]
(def input (read-val ">"))
(if (not= input "0")
(recur (conj ins input))
return-value-goes-here))
and replace `def` with `let` for binding locals
(loop [ins inputs]
(let [input (read-val ">")]
(if (not= input "0")
(recur (conj ins input))
return-value-goes-here)))
Problem
I'm new to Clojure and was hoping SO could help me out here: ``` ;; a loop to collect data (defn read-multiple [] (def inputs (list)) (loop [ins inputs] (def input (read-val ">")) (if (not= input "0") (recur (conj ins input))) (i-would-like-to-return-something-when-the-loop-terminates))) ``` How do I, after collecting the input, get a list of all the input collected thus far?