Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
block
Type: |
- |
special form (fsubr) |
Source: |
- |
xlcont.c |
Syntax
- (block name [body ... ])
- name - an unevaluated symbol for the block name
body - an arbitrary number of Lisp expressions
returns - the value of the last expression
Description
The 'block' special form specifies a 'named block'
construct. The last expression in 'body' will be returned by
the 'block' construct as its result unless a return
or return-from is executed within 'block'.
The return exit will exit the nearest
[inner-most] 'block'.
The return-from exit will exit
the specified 'block'.
Examples
(defun test ()
(block outer ; outer BLOCK
(print "outer")
(block inner ; inner BLOCK
(print "inner")
(return-from outer "all done")
(print "won't get here"))))
> (test)
"outer" ; screen output of PRINT
"inner" ; screen output of PRINT
"all done" ; return value
See defun, print,
return-from.
See also:
Back to Top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference