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.

go

go

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

SYNTAX

(go <tag-symbol> )
        <tag-symbol>    -       a symbol 

DESCRIPTION

The GO special form allows 'go-to' style branching within 'block' constructs (DO, DO*, DOLIST, DOTIMES, TAGBODY, LOOP, PROG and PROG*). The <tag-symbol> is the 'label' and must exist somewhere within the 'block' that the GO occurs within. Otherwise an error will be generated - "error: no target for GO". GO never returns a value. If the <tag-symbol> exists, then the execution will continue immediately after the <tag-symbol>.

EXAMPLES

(defun foo (i j)                        ; define FOO
  (prog ()                              ; with a PROG
         (print "begin")                ;
   start (print j)                      ; tag - START
         (setq j (1- j))                ;
         (if (eql i j) (GO start)       ; 2-way branch
                       (GO end))        ; 
         (print "hello")                ; won't ever be reached
   end   (print "done")                 ; tag - END
         (return 42)))                  ; 
(foo 1 2)                               ; prints  "begin" 2 1 "done"
                                        ;   returns 42
(foo 2 1)                               ; prints  "begin" 1 "done"
                                        ;   returns 42

NOTE: Although GO will accept a <tag-symbol> that is not a symbol, it will not find this improper <tag-symbol>. An error will be generated - "error: no target for GO".


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