Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

loop

loop

type: special form (fsubr)
location: built-in
source file: xlcont.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(loop  <body> ...  )
        <body>          -       a series of expressions

DESCRIPTION

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.

EXAMPLES

(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.


Go to the first, previous, next, last section, table of contents.