The loop construct is the simplest form of iteration provided by LISP. In its simplest form It allows you to execute some statement(s) repeatedly until it finds a return statement.
It has the following syntax −
Create a new source code file named main.lisp and type the following code in it.
(setq a 10) (loop (setq a (+ a 1)) (write a) (terpri) (when (> a 17) (return a)) )
When you execute the code, it returns the following result −
11 12 13 14 15 16 17 18
Please note that without the return statement, the loop macro would produce an infinite loop.