XLISP prog2

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# prog2

Type: | - | special form (fsubr)
Source: | - | xlcont.c

## Syntax

(prog2 [expr1 expr2 ... ])
  exprN - expressions comprising the body of the loop
  returns - the value of the second expression

## Description

The 'prog2' special form is basically a 'block' construct that contains a block of code [expressions] to evaluate. The value of the second expression 'expr2' will be returned as the result of 'prog2'. If there is no 'expr2', 'expr1' is returned. If there is no 'expr1', NIL is returned.

## Examples

    (prog2 (print "hi") (print "ho"))  ; prints "hi" "ho"  returns "ho"
    (prog2)                            ; returns NIL
    (prog2 (print "hi"))               ; prints "hi"  returns "hi"
    (prog2 (print "ho") "hey")         ; prints "ho"  returns "hey"
    (prog2 'a 'b 'c)                   ; returns B

Note: prog1 , 'prog2', progn and progv do not allow the use of return or go or tags for go.

See the prog2 special form in the XLISP 2.0 manual.

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference