The 'go' special form allows 'goto' style branching within 'block' constructs
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'.
(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
See the
go
special form in the