Next: , Previous: , Up: Truth   [Contents][Index] If Special Operator

The simplest conditional in Common Lisp is if. It usually takes three arguments:

The test expression is evaluated; if it returns ‘true’, the then expression is evaluated and its value is returned; but if the test expression returns ‘false’, the else expression is evaluated and its value is returned.

Like quote, if is a special operator. It could not possibly be implemented as a function, because the arguments in a function call are always evaluated, and the whole point of if is that only one of the last two arguments is evaluated.

The else expression is optional, and will default to ‘NIL’ if it is omitted.