Logical Operators

(or x_1 ... x_n ) evaluates each of x_1 ... x_n in order. As soon as any x_i returns a value other than #f, or returns that value without evaluating any remaining x's. If every x_i returns #f, the value of or is #f.


   (or (> cash 100)
       (write "Dear Dad: Send money!"))

We can use or to try different methods in order:


   (or (ask-for 'toy)
       (ask-for 'book)
       (ask-for 'educational-book))

(not x ) returns #t if x is #f; otherwise, it returns #f.


   (if (and (warm? today)
            (not (raining? today))) ...)

(boolean? x ) returns #t if x is #t or #f; otherwise, it returns #f.

Contents    Page-10    Prev    Next    Page+10    Index