Go to the first, previous, next, last section, table of contents.


nil and t

The two boolean values in Lisp are the symbols nil (FALSE) and t (TRUE). Both these symbols always evaluate to themselves (so they do not have to be quoted), any attempt to change their values is an error.

All of the conditional instructions regard anything which is not nil as being TRUE (i.e. not-FALSE). The actual symbol t should be used where a TRUE boolean value must be explicitly stated to increase the clarity of the code.

This is not the end of the story; nil actually has another meaning: it represents the empty list. This is a consequence of how lists are constructed in Lisp, a list of zero elements is stored as the symbol nil.

To the Lisp system itself there is absolutely no difference between () (the notation for a list with zero elements) and nil (the symbol nil). When writing code however, the list notation is usually used when the programmer regards the value as a list and the nil notation when its value as a boolean is to be emphasised.


Go to the first, previous, next, last section, table of contents.