I'm trying to make a function where after 7 values are entered, they are put into an array and from that array, each element is added to another variable (avg).
I keep getting "The variable AVG is unbound". I don't see where the problem is.
(defun readTestScores()
(let ((examScore 0)
(avg 0)))
(setf testScore (make-array 7))
(format t "~&ENTER EXAM SCORE ~23T: ")
(setq examScore(read))
(format t "~&ENTER ALL TEST SCORES ~23T: ")
(dotimes (i 7)
(setf (aref testScore i) (read))
)
(dotimes (i 7)
(setq avg (+ avg (aref testScore i)))
)
)
(readTestScores)
letis closed right after you have bound the variables. TO be able to referenceavgyou have the rest of the code in the body of thelet. The function doesn't return anything. What is it supposed to do?