I wrote the following function to print a value for 10 times:
(defn test-let []
(loop [index 0]
(when (< index 10)
(let [x 2]
(println "Value of x: " x))
(recur (inc index)))))
My question is:
Did because of
letinside theloop, 10 variables (representing the value 2) and only 1 symbol (x, that represent the variable that holds value2) got created?If 10 variables were created, at what point they qualify for garbage collection?