progn

AutoCad AutoLISP Functions

 
progn
 
 
 

Evaluates each expression sequentially and returns the value of the last expression

(progn [expr]...)

You can use progn to evaluate several expressions where only one expression is expected.

Arguments

expr

One or more AutoLISP expressions.

Return Values

The result of the last evaluated expression.

Examples

The if function normally evaluates one then expression if the test expression evaluates to anything but nil. The following example uses progn to evaluate two expressions following if:

(if (= a b)
  (progn
    (princ "\nA = B ")
    (setq a (+ a 10) b (- b 10))
  )
)
See Also
    • The if function.