GNU Info

Info Node: (emacs-lisp-intro.info)Truth & Falsehood

(emacs-lisp-intro.info)Truth & Falsehood


Next: save-excursion Prev: else Up: Writing Defuns
Enter node , (file) or (file)node

Truth and Falsehood in Emacs Lisp
=================================

   There is an important aspect to the truth test in an `if'
expression.  So far, we have spoken of `true' and `false' as values of
predicates as if they were new kinds of Emacs Lisp objects.  In fact,
`false' is just our old friend `nil'.  Anything else--anything at
all--is `true'.

   The expression that tests for truth is interpreted as "true" if the
result of evaluating it is a value that is not `nil'.  In other words,
the result of the test is considered true if the value returned is a
number such as 47, a string such as `"hello"', or a symbol (other than
`nil') such as `flowers', or a list, or even a buffer!

nil explained
`nil' has two meanings.

automatically generated by info2www version 1.2.2.9