You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
601 B
601 B
Booleans
Racket 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