foreach

(foreach symbol list term1 ...)

The foreach function assigns each element in a list to the specified symbol and evaluates the specified expression for each element of the list.

The function returns the result of the last expression evaluated.

Examples

: (foreach el '(1 2 3) (princ el))

1233

: (setq x 0)

0

: (foreach el '(1 2 3) (setq x (+ x el)) (princ x)(terpri))

1

3

6

nil