if


(if  condition  then-expression  [ else-expression ] )

This function evaluates then-expression or else-expression depending on result of evaluating condition.

Arguments

condition  any single Lisp expression, to be evaluated if "condition" is non-NIL ("then" case)

then-expression  any single Lisp expression, to be evaluated if "condition" is NIL ("else" case)

else-expression  (optional)

Return

last evaluated expression

Example

(if (not C:MyCommand) (load "MyCommand.lsp") (princ))  loads "MyCommand.lsp" if C:MyCommand is not defined

Remarks

(progn ...) can be used to combine multiple expressions for the "then" / "else" branches



©  Bricsys NV. All rights reserved.