type: special form (fsubr) location: built-in source file: xlcont.c Common LISP compatible: yes supported on: all machines
(loop <body> ... ) <body> - a series of expressions
The LOOP special form specifies a 'repeat-forever' construct. The expressions in <body> will be evaluated. When the last expression is evaluated in <body>, LOOP will then repeat the <body>. When a RETURN is evaluated within a LOOP, the specified value will be returned. LOOP itself does not generate a return value. Other exit mechanisms include GO, THROW, RETURN-FROM and errors.
(setq i 65) ; initial value (loop ; LOOP (princ (int-char i) ) ; print the character (if (= i 90) (return "done")) ; test for limit (setq i (1+ i) ) ) ; increment and repeat ; prints ; ABCDEFGHIJKLMNOPQRSTUVWXYZ ; returns "done"
NOTE: If you create a LOOP with no exit mechanism, you will probably have to abort your XLISP session.