Guide: PLT Scheme

1`` | Welcome to PLT Scheme
2`` | Scheme Essentials
3`` | Built-In Datatypes
4`` | Expressions and Definitions
5`` | Programmer-Defined Datatypes
6`` | Modules
7`` | Contracts
8`` | Input and Output
9`` | Regular Expressions
10`` | Exceptions and Control
11`` | Iterations and Comprehensions
12`` | Pattern Matching
13`` | Classes and Objects
14`` | Units (Components)
15`` | Reflection and Dynamic Evaluation
16`` | Macros
17`` | Performance
18`` | Running and Creating Executables
19`` | Compilation and Configuration
20`` | More Libraries
| Bibliography
| Index

Version: 4.0.2
contents index
← prev up next →

#### 3.1`` Booleans

Scheme has two distinguished constants to represent boolean values: #t for true and #f for false. Uppercase #T and #F are parsed as the same values, but the lowercase forms are preferred.

The boolean? procedure recognizes the two boolean constants. In the result of a test expression for if, cond, and, or, etc., however, any value other than #f counts as true.

Examples:
> (= 2 (+ 1 1))
#t
> (boolean? #t)
#t
> (boolean? #f)
#t
> (boolean? "no")
#f
> (if "no" 1 0)
1

contents index
← prev up next →