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

The Boolean Values #t and #f

Scheme provides a special unique object, whose written representation is #f, called false. This object counts as false if it's the result of a condition expression in an if (or cond) expression. In most Schemes, this is the only value that counts as false, and all others count as true.

The false object is not the same thing as the integer zero (as it is in C), and it's not the same thing as a null pointer (as it is in Lisp). The false object is a unique object.

For convenience and clarity, Scheme also provides another boolean value, written #t, which can be used as a true value. Note that in general, any value other than false is true, but the special boolean object #t is a good one to use when all you want to say is that something is true--returning the true boolean makes it clear that all you're returning is a true value, not some other value that conveys more information.

Like other objects, Booleans are conceptually objects on the heap, and when you write #t or #f, it means "a pointer to the canonical true object" or "a pointer to the false object."

Scheme provides a few procedures and special forms for operation on booleans. The procedure not acts as a not operator, and always returns true or false (#t or #f). If applied to #f, it returns #t. Since all other values count as true, applying not to anything else returns #f.


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